The practice of configuring multiple IP addresses on a particular network interface is called IP aliasing.

You can assign multiple IP addresses to one network interface from a single subnet or completely different ones.

First step :  get the ifconfig command into our system

To get the ifconfig command into our system , run the below given command:

yum install net-tools

Good! now you can type ifconfig to test the command.

Second step : IP aliasing

Now let’s assume that we want to create three additional virtual interfaces to bind three IP addresses (172.16.16.126, 172.16.16.127, and 172.16.16.128) to the NIC. So, we need to create three additional alias files, while “ifcfg-eth0” keeps the same primary IP address. This is how we moving forward to setup three aliases to bind the following IP addresses.

Create three files to contain each interface parameters; for example, we copying existing parameters of interface “ifcfg-eth0” in virtual interfaces called ifcfg-eth0:0, ifcfg-eth0:1 and ifcfg-eth0:2. Go into the network directory and create the files as shown below.

# cd /etc/sysconfig/network-scripts/
# cp ifcfg-eth0 ifcfg-eth0:0
# cp ifcfg-eth0 ifcfg-eth0:1
# cp ifcfg-eth0 ifcfg-eth0:2

File “ifcfg-eth0” :

[root@tecmint network-scripts]# vi ifcfg-eth0

DEVICE="eth0"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=172.16.16.125
NETMASK=255.255.255.224
GATEWAY=172.16.16.100
HWADDR=00:0C:29:28:FD:4C
ifcfg-eth0:0
DEVICE="eth0:0"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=172.16.16.126
NETMASK=255.255.255.224
GATEWAY=172.16.16.100
HWADDR=00:0C:29:28:FD:4C
ifcfg-eth0:1
DEVICE="eth0:1"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=172.16.16.127
NETMASK=255.255.255.224
GATEWAY=172.16.16.100
HWADDR=00:0C:29:28:FD:4C
ifcfg-eth0:2
DEVICE="eth0:2"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=172.16.16.128
NETMASK=255.255.255.224
GATEWAY=172.16.16.100
HWADDR=00:0C:29:28:FD:4C

Once, you’ve made all changes, save all your changes and restart/start the network service for the changes to reflect.

[root@tecmint network-scripts]# /etc/init.d/network restart