In linux, we sometimes need to set different IP addresses for a single NIC, which involves binding multiple IP addresses to a single NIC. This method can be used to easily bind multiple IP addresses to a single NIC. The environment used by the author is centos5.6, which should be applicable to both fedora and rhel ....
In linux, we sometimes need to set different IP addresses for a single NIC, which involves binding multiple IP addresses to a single NIC. This method can be used to easily bind multiple IP addresses to a single NIC. The environment used by the author is centos5.6, which should be applicable to both fedora and rhel.
We know that the storage path of linux network devices is/etc/sysconfig/network-scripts/
The network adapter we want to apply is eth0. let's take a look at the IP address of the device.
IP: 192.168.234.128
Brast: 192.168.234.255
Mask: 255.255.255.0
To add an IP, you only need to create a ifcfg-eth0 in/etc/sysconfig/network-scripts/: x (x can be 0, 1, 2 .......). For ease we can talk about ifcfg-eth0, copy a Copy named ifcfg-eth0: 1 and then modify the file.
# Cat ifcfg-eth0 [root @ localhost network-scripts] #
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE = eth0 (modified to eth0: 1)
BOOTPROTO = none
HWADDR = 00: 0C: 29: 96: 93: CA
ONBOOT = yes (indicates that the instance is enabled and retained)
NETMASK = 255.255.255.0
IPADDR = 192.168.234.128 (changed to the new ip address 192.168.234.100)
GATEWAY = 192.168.234.255
TYPE = Ethernet
USERCTL = no
IPV6INIT = no
PEERDNS = yes
Modified results:
Enable the device and run the command ifup eth0: 1.
Next, we will test the ping function on another computer.
After testing, we can add an IP address. we can also add n ip addresses.
This article comes from "cloud computing, IT is no longer important ." Blog