Method 1:
A small number of IP manual binding (here to bind IP to eth0 for example, the other network adapter words to modify the corresponding file name can be)
1. Copy the Ifcfg-eth0 network adapter profile and rename it to ifcfg-eth0:0
cp/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-scripts/ifcfg-eth0:0
2. Edit the ifcfg-eth0:0 file
Vim/etc/sysconfig/network-scripts/ifcfg-eth0:0device= "Eth0:0″ #这里修改为eth0:0 Consistent with file names bootproto=" Static "#协议为静态, with no NE can also hwaddr= "00:0c:29:6f:62:a7″ #MAC地址ONBOOT =" Yes "#开机启用此网卡IPADDR =192.168.1.3 #新绑定的IPNETMASK =255.255.255.0 #子网掩码GATEWAY =192.168.1.1 #网关
Edit and save exit, then enable this NIC
Ifup eth0:0
Then try the ping again, if you can ping the words, you can.
Method 2:
Automatic binding of an IP segment or multiple IP segments (also here, eth0 for example, the other network card to modify the corresponding file name can be)
1. Create a new Ifcfg-eth0-range0 file (note that the filename here does not change the location of the range or the wrong word, otherwise the bound IP will not take effect, if you have a few pieces of IP to bind to the eth0, you can create a new ifcfg-eth0-range1 , Ifcfg-eth0-range2 and other files, but note that the Clonenum_start values defined in each range file cannot overlap, otherwise there will be a problem. )
/etc/sysconfig/network-scripts/ifcfg-eth0-range0
Write the following content
Device=eth0 #绑定IP段的网卡名称ONBOOT =yes #开机启用此网卡BOOTPROTO =static #协议为静态IPADDR_START =192.168.0.101 #网段的起始IPI paddr_end=192.168.0.120 #网段的截止IPNETMASK =255.255.255.255 #子网掩码CLONENUM_START =0 #这个数字是网卡别名的开始位置, for example, 3 here means eth0:0, And will be Ipaddr_start set IP192.168.0.101 bound to eth0:0, and so on No_aliasrouting=yes//This parameter is the function of the packet is always through the eth0 in and out, do not walk the network card alias (such as eth0:0), Setting this parameter can speed up the response of the route, so it is highly recommended to configure
After you modify it, save the exit and then restart the network:
Service Network restart
Test it again, if you can ping it, you can.
This article is from the "Margin with Wish" blog, please be sure to keep this source http://281816327.blog.51cto.com/907015/1615250
CentOS Network Basics: (4) set up single-Nic multi-IP