How to configure an IP range on Ubuntu 16/18

A guide that describes how to configure an IP range

The following tutorial will describe how to easily configure an IP range on Ubuntu 16/18 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

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.

ipconfig


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.

ens3 ip setup


At Cherry Servers, Ubuntu 16/18 network configuration is located on /etc/network/interfaces.d/50- cloud-init.cfg file.

cloud-init.cfg

 

The IP range configuration process is different on Ubuntu than that on CentOS. Instead of a single IP range file, every IP address has to be configured manually. In the IP range’s control panel on the client area, we’ll find the necessary IP range’s technical information.

setup gateway on cherry servers

 

Using that information, open the /etc/network/interfaces.d/50-cloud-init.cfg file with your preferred text editor and add the additional IP addresses:

how to add additional ip adresses


Once again, please note that every additional IP address is bonded to the main network interface, which in this case is “ens3”, followed by a colon and a number for the additional IP address that’s increased with every additional IP address. Next, the IP address, gateway and netmask are entered.
Once you’ve configured all IP address, save and close the file. Now run the “ip a” command again to check if the IP addresses were successfully configured.

ip a command


The output confirms IP addresses were configured and they’re now ready for use in production.