How to Bind Multiple IP Addresses on a CentOS 7 Linux Server

Try it in our public cloud & Get $5 Credit

How to Bind Multiple IP Addresses on a CentOS 7 Linux Server

Many complex network setups require that multiple IP addresses be bound to a single server. This might happen if you have presences on both public and private networks, or need to support multiple servers that expect to bind the same port. It is also useful to secure services by binding them on private IPs, or by creating firewall rules that keep traffic quarantined. Here is how you would go about assigning multiple IP addresses to your CentOS 7 server.

Getting Started

To complete this guide, you will need the following:
• 1 Node (Cloud Server or Dedicated Server) with CentOS 7.


In this guide, we’ll be working with a network with this configuration:
• Network CIDR::
• First usable IP:
• Last usable IP:
• Gateway:
• Netmask:

With those basic specifications established, let’s set up your server to respond accordingly.

We start by configuring the eth0 interface. This is done by editing the interface script.

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

Insert this block of text:


We’ll now need another configuration file for the other IP.

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


service network restart

With the above configuration in place, your server should now respond to all of the IPs specified in this example. Traffic will route out through the configured gateway. You can now set up arbitrary servers bound to the IPs on your newly-created network.

Because each server is on its own IP, they can also bind the same ports. You could, for instance, have two separate Apache instances configured distinctly, each answering port 80 on any of the IPs you’ve just created.


While this example was quite simplistic, the basic principles are the same regardless of complexity. If you can understand the above, it is simple to scale the configuration up to arbitrarily complex networks, each with separate gateways, and to allocate ranges of IP addresses separately to programs and services on the same CentOS server. If this guide was helpful to you, kindly share it with others who may also be interested.