1. Configure the first IP address:
[root@Linux root]#cd /etc/sysconfig/network-scripts
[root@Linux network-scripts]#vi ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.80.255 //*broadcast address*//
IPADDR=192.168.80.189 //*First IP address*//
NETMASK=255.255.255.0 //*Network mask*//
NETWORK=192.168.80.0 //*Network segment*//
ONBOOT=yes
:wq //*Save and exit*//
2. Copy the first IP address configuration file to the second IP address configuration file, and modify the IP address inside:
[root@Linux network-scripts]#cp ifcfg-eth0 ifcfg-eth1
[root@Linux network-scripts]#vi ifcfg-eth1
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.80.255 //*broadcast address*//
IPADDR=192.168.80.199 //*Second IP address*//
NETMASK=255.255.255.0 //*Network mask*//
NETWORK=192.168.80.0 //*Network segment*//
ONBOOT=yes
:wq //*Save and exit*//
3. Restart the network card:
[root@Linux network-scripts]#service network restart
or:
[root@Linux network-scripts]#ifdown eth0
[root@Linux network-scripts]#ifup eth0
or
[root@Linux network-scripts]#ifconfig eth0 down
[root@Linux network-scripts]#ifconfig eth0 up