To do this, log in to SSH:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0:0
The second IP is a
Vi/etc/sysconfig/network-scripts/ifcfg-eth0:1
A third IP is the
Ifcfg-eth0:2 (from this analogy)
Device=eth0:0 NIC device name Onboot=YES random start Bootproto= static statically assigned ipipaddr=*.* . * * the IP address to add netmask=255.255. 255.0 Subnet Mask (subject to actual) GATEWAY=*.*.*.* Routing
If the IP is contiguous, you can use the following method.
vi/etc/sysconfig/network-scripts/ifcfg-eth0-Rangedevice=Eth0bootproto=static Ipaddr_start= start ipipaddr_end= end Ipclonenum_start= network card start number netmask= Subnet Mask onboot =yes
Saving the file and then restarting the Network service takes effect.
The following is the Ubuntu
192.168. 0.2 255.255. 255.0 ifconfig add eth0: 1 192.168. 0.2 255.255. 255.0 ifconfig add eth0: 2 192.168. 0.2 255.255. 255.0 where Eth0:1 and Eth0:2 are the two IPs added. You must join the startup item after it is added, or the virtual add IP will be lost after the reboot. Add the above command to:/etc/rc.d/rc.local.
How to add multiple IP addresses to the CentOS configuration IP address