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.