How To Bind Multiple IP Addresses to One Network Interface on Enterprise Linux 7

  • by
Here are the steps that you can add more IP address into the network card.

Copy the configuration file of eth0 as eth0:0
[root@test ~]# cp -p /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
Modify the configuration
[root@test ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
...
DEVICE=eth0:0
...
IPADDR=192.168.0.111
...

Take the network effective.
[root@test ~]# systemctl restart network
Verify the result
[root@test ~]# ip a s eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:7f:dc:81 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.11/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.0.111/24 brd 192.168.0.255 scope global secondary eth0:0
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe7f:dc81/64 scope link
       valid_lft forever preferred_lft forever

Done!

Leave a Reply

Your email address will not be published. Required fields are marked *