Bind Additional IPs to NIC - CentOS & Apache


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

When installing standard operating system, Rad Web Hosting generally binds the primary server IP to eth0 network interface. 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

Begin by accessing your server via SSH and running the following command:

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

Now copy this file to create the virtual interfaces for additional IP addresses, as needed

# 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

Restart the network to finalize the process and ensure new interfaces are started cleanly:

# service network restart

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

  • ip address, network configuration, server setup, centos
  • 217 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Related Articles

Forcefully Delete an IP Address from SolusVM

If at any point you find you have an orphaned ipaddress, you can delete it by running the...

Do You Offer a Hardware Firewall Solution?

Yes, we have a very limited selection of hardware firewalls available. We appreciate the specific...

View Server PHP Environment with phpinfo.php

The phpinfo() function outputs a huge amount of information about the system you're using, such...

How to Create Sudo User on CentOS

This article provides step-by-step setup guide for adding Sudo user to CentOS system. The sudo...

How to Use Sudo

This article provides a guide to using a Sudo user on CentOS server. From the command line,...