Binding A Range Of IP Address To One Ethernet Interface

A single Network Interface Card (NIC) can be configured with multiple IP addresses. Suppose, you have a web server having multiple domains and each uses SSL, then you need to assign a dedicated IP address for each of the domain. If you have only one ethernet card available in your server, you can make use of the feature called IP aliasing to assign multiple IP addresses on a single NIC card.

In this article, we will go through the temporary and permanent implementation of IP aliasing.

1. Temporarily adding multiple IP addresses on a NIC.

You can use the 'ifconfig' command to add an IP address to a NIC. But, please note that this IP address will not be available after rebooting the machine. So, you need to use the second step for permanently adding the multiple IP addresses. Here, we assume that you already have a NIC with a static IP configured in it. If we need to add two more IP addresses, say and to this interface, we can accomplish this by executing the following commands:

ifconfig eth0:1 netmask
ifconfig eth0:2 netmask

2. Permanently implementing IP aliasing.

In order to add multiple IP addresses to a single NIC, we need to modify the configuration files available in the folder '/etc/sysconfig/network-scripts/'.

a. Adding multiple IP addresses.

The configuration for eth0 interface can be found at '/etc/sysconfig/network-scripts/ifcfg-eth0'.
cat /etc/sysconfig/network-scripts/ifcfg-eth0:


The "DEVICE" mentions the device name. This will be different for each IP alias. The parameter "ONBOOT" specifies whether the IP address should be active on reboots. This should be set to "yes" for automatically activating the IP address during reboot. The parameter "BOOTPROTO" can be static or DHCP. For static IP addresses, it should be set to static. If the IP address is getting allotted dynamically by a DHCP server, this should be set to DHCP. The parameter "IPADDR" parameter should be given with the exact value of static IP address.

In order to add the IP address on this NIC, you need to copy the above file into '/etc/sysconfig/network-scripts/ifcfg-eth0:1' and modify it as follows.

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1
cat /etc/sysconfig/network-scripts/ifcfg-eth0:1

As you can see from the above snippet, we have just modified the fields DEVICE and IPADDR.
Finally, you need to restart 'network' service for the changes to get updated:

service network restart

b. Adding an IP address range.

In order to add a range of IP addresses to eth0 interface, say from to, you need to create (update) the file /etc/sysconfig/network-scripts/ifcfg-eth0-range0 with the following data:


Then restart the network service,

service network restart

Now, you will be able to see the configured IP addresses using 'ifconfig' command.

Bobbin Zachariah 6:28 pm

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author's All Posts
Like to become part of Linoxide Team and contribute tips? Contact us here.


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

All comments are subject to moderation.