How to Bind Additional IPs to Network Interface Card - CentOS

This article explains the process of binding multiple IP addresses to the Network Interface Card (NIC) on a CentOS Dedicated Server. This process is a helpful tool for a number of applications, notably Apache-based website hosting. 

We only bind the primary server IP as our clients have many use-case for how they like to use their IP's. In this demonstration, you would need to add the additional IP's to the server by editing the following location:

/etc/sysconfig/network-scripts/ifcfg-eth0-range0

Start by SSH your server and running the following command:

# cd /etc/sysconfig/network-scripts/ifcfg-eth0-range0

Now copy this file to create the virtual interfaces for additional IPs

# cp ifcfg-eth0 ifcfg-eth0:0
# cp ifcfg-eth0 ifcfg-eth0:1
# cp ifcfg-eth0 ifcfg-eth0:2
# cp ifcfg-eth0 ifcfg-eth0:3
# cp ifcfg-eth0 ifcfg-eth0:4


Open the file “ifcfg-eth0:0“ to view the contents:

DEVICE="eth0:0"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=216.245.203.194
NETMASK=255.255.255.248
GATEWAY=216.245.203.192
HWADDR=00:0C:29:28:FD:4C


Simply edit the subsequent virtual interfaces, following this formula, to bind the additional IPs to the NIC (Only Changes need to be made to the DEVICE and IPADDR assignments):

DEVICE="eth0:1"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=216.245.203.195
NETMASK=255.255.255.248
GATEWAY=216.245.203.192
HWADDR=00:0C:29:28:FD:4C


DEVICE="eth0:2"
BOOTPROTO=static
ONBOOT=yes TYPE="Ethernet"
IPADDR=216.245.203.196
NETMASK=255.255.255.248
GATEWAY=216.245.203.192
HWADDR=00:0C:29:28:FD:4C


You have now successfully added the additional server IPs to the public NIC and they are ready for use.

Was this answer helpful?

 Print this Article

Also Read

Assigning a Dedicated IP Address to a Subdomain using WHM

To assign a dedicated IP address to a subdomain, perform the following steps: Step 1: Add the...

How to Modify Primary Domain of Webuzo Server

How to Change Root Password Using SSH

This article explains the method of changing the root password on a Linux Server using SSH. SSH...

Resolve "Configure: Error: No Acceptable C Compiler Found in $PATH"

When installing software to your Ubuntu VPS or Dedicated Server, you may encounter an error:...

Reboot Linux Server Using SSH

This article provides a guide for Rebooting a Linux-based VPS or Dedicated Server Using the SSH...