Linux system single NIC binding multiple IP addresses

Source: Internet
Author: User
Tags linux

Description

Single NIC binding two IP addresses, telecommunications and Unicom, the purpose: to be used when the telecom out of fault unicom normal use.

System IP Address Subnet mask Gateway
CentOS 6.3_64bit eth0:116.18.176.19 255.255.255.0 192.168.1.1
eth0:0:172.188.174.20 255.255.255.0 192.168.1.1
... ... ...

1, the Linux network device storage path is/etc/sysconfig/network-scripts into the directory:

[Root@localhost ~]# cd/etc/sysconfig/network-scripts/

[Root@localhost network-scripts]# LL

Total 196

-rw-r--r--. 1 root 212 Mar 22:15 Ifcfg-eth0

2. Create a ifcfg-eth0:x on the/etc/sysconfig/network-scripts directory (x can be 0,1,2 ...). For simplicity we can speak Ifcfg-eth0, copy a name to ifcfg-eth0:0, and then modify the configuration file.

[Root@localhost network-scripts]# CP Ifcfg-eth0 ifcfg-eth0:0

3. Edit ifcfg-eth0:0 Virtual IP

[Root@localhost network-scripts]# Vim ifcfg-eth0:0

Device= "eth0:0"//Modify the name of the device

bootproto= "Static"//[none|static|bootp|dhcp] (do not use protocol at boot | static Allocation | BOOTP protocol | DHCP protocol)

ipaddr=172.188.174.20//Modify IP Address

netmask=255.255.255.0//Subnet mask

gateway=192.168.1.1//Gateway

broadcast= ' 192.168.1.255 '//broadcast address

Hwaddr= "00:0c:29:c9:6d:11"//mac address

Nm_controlled= "Yes"

onboot= "yes"//power-on Activation

: Wq

If you need to bind more than one IP address, simply add the file name and the eth0:x in the device in the file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.