Bind multiple IP addresses to the network card of CentOS
Last Update:2017-06-20
Source: Internet
Author: User
All devices in CentOS are files. the NIC is also defined in the file. to bind an IP address, you only need to change the file. nic files are located in the directory:/etc/sysconfig/network-scripts to query the current IP information: ifconfig: eth0Linkencap: all devices in Etherne CentOS are files. the NIC is also defined in the file. to bind an IP address, you only need to change the file. nic files are in the directory: /Etc/sysconfig/network-scripts: ifconfig: eth0 Link encap: Ethernet HWaddr 00: 50: 56: AC: 6B: 0F Inet addr: 42.51.135.206 Bcast: 42.51.135.255 Mask: 255.255.255.0 Inet6 addr: fe80 :: 250: 56ff: fead: 6b0f/64 Scope: Link UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1 RX packets: 374772 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 35165 errors: 0 dropped: 0 overruns: 0 carrier: 0 Collisions: 0 fig: 1000 RX bytes: 28759089 (27.4 MiB) TX bytes: 4779278 (4.5 MiB) there is a file under the current directory: ifcfg-eth0 new file under the Directory: ifcfg-eth0: 1 content is as follows: DEVICE = eth0: 1 IPADDR = 255.255.255.0HWADDR = 00: 50: 56: AC: 6B: 0FNM_CONTROLLED = yesONBOOT = yesBOOTPROTO = dhcpTYPE = EthernetIPV6INIT = noUSERCTL = no ifcfg-eth0: 2 DEVICE = eth0: 2 IPADDR = 255.255.255.0HWADDR = 00: 50: 56: AC: 6B: 0FNM_CONTROLLED = yesONBOOT = yesBOOTPROTO = dhcpTYPE = EthernetIPV6INIT = noUSERCTL = no ifcfg-eth0: 3 DEVICE = eth0: 3 IPADDR = 42.51.138.3NETMASK = 255.255.255.0HWADDR = 00: 50: 56: AC: 6B: 0FNM_CONTROLLED = yesONBOOT = yesBOOTPROTO = dhcpTYPE = EthernetIPV6INIT = noUSERCTL = no restart Nic: service network restart: check the IP address eth0 at this time. Link encap: Ethernet HWaddr 00: 50: 56: AC: 6B: 0F Inet addr: 42.51.135.206 Bcast: 42.51.135.255 Mask: 255.255.255.0 Inet6 addr: fe80 :: 250: 56ff: fead: 6b0f/64 Scope: Link UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1 RX packets: 384344 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 35241 errors: 0 dropped: 0 overruns: 0 carrier: 0 Collisions: 0 fig: 1000 RX bytes: 29462159 (28.0 MiB) TX bytes: 4791402 (4.5 MiB) eth0: 1 Link encap: Ethernet HWaddr 00: 50: 56: AC: 6B: 0F Inet addr: 42.51.138.1 Bcast: 42.51.138.255 Mask: 255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1 eth0: 2 Link encap: Ethernet HWaddr 00: 50: 56: AC: 6B: 0F Inet addr: 42.51.138.2 Bcast: 42.51.138.255 Mask: 255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1 eth0: 3 Link encap: Ethernet HWaddr 00: 50: 56: AC: 6B: 0F Inet addr: 42.51.138.3 Bcast: 42.51.138.255 Mask: 255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU: 1500 Metric: 1 test: ping the above IP addresses on other machines.