How to configure an IP range on Centos 6/7 OS

A guide that describes how to configure an IP range.

The following tutorial will describe how to easily configure an IP range on CentOS 6/7 operating systems, providing you’ve already assigned the IP addresses to a server via client area. If you haven’t please first refer to the IP range assignation tutorial, located at: https://docs.cherryservers.com/knowledge/how-to-assign-a-newly-ordered-ip-range

IMPORTANT: you must first deactivate network manager in CentOS 7 to make the IP range file functional.

By default, all Linux servers are provided with one main IP address, as we can see in the screenshot below using the “ip a” command. Alternatively, you can use “ifconfig” command to see the output.

ip range tutorial

 

The IP range is configured on the main network interface. In this case, it’s called “ens3”, so we’ll bond the IP range with it.

bond ip range


CentOS 6/7 network configuration is located at /etc/sysconfig/network-scripts/. The main network interface configuration file is called ifcfg-$NET-ADAPTER-NAME. In this case, it’s ifcfg-ens3.

network scripts


To make the process easier, we’ll create an IP range file. This will allow us to configure multiple IP addresses with little work. Using your preferred text editor, in the /etc/sysconfig/network-scripts directory, create a file called ifcfg-ens3-range0

ifcfg-ens3-range0

 

In the IP range’s control panel on the client area, we’ll find the necessary IP range’s technical information.

cherry servers network settings


Using that information, let’s configure the IP range file on our operating system:

ip range file



Save the changes and exit the text writer. If you’ve done everything correctly, you’ll see a new network configuration file has appeared in /etc/sysconfig/network-scripts/ directory:

sysconfig ip

 

Finally, restart the network service and check the IP configuration again. The IP range is now fully configured:

configured ip range