Use a Range File to Setup Multiple IPs
You can in some cases use a range file to set up a whole subnet inside your dedicated server. By using a range file you can quickly deploy a subnet but this does have some disadvantages. When you use a range file you cannot specify a BROADCAST for each individual IP and on some servers, depending on what type of router is used you will need to specify this field or you will see inconsistent results.
Using this method will work on any RedHat based system so this is good for Fedora, CentOS, ClearOS
First, create the file
Inside the file add the following information
IPADDR_START=START IP IPADDR_END=END IP CLONENUM_START=0 NETMASK=255.255.255.0 ARPCHECK=no
So, if you had a /29 subnet for example 192.168.0.0/29 you would place 192.168.0.0 in the IPADDR_START field. And 192.168.0.7 in the IPADDR_END field. Save and close the file then restart the network or reboot your server and the subnet assigned to that server should start to work.
Configuring Multiple Subnets Using Range Files
You can use this method to set up multiple subnets inside your server. But to do this you have to make sure that the CLONENUM_START field has a unique number. To set up another subnet in the same server create a new range file;
In our previous example, we configured a /29 subnet. This subnet has 8 IPs so, we need to increase the CLONENUM_START= number by 8 because 8 interfaces would have been created in the first step. This time in the CLONENUM_START= field place a 9. So by doing this each IP will have a unique interface.
IPADDR_START=START IP IPADDR_END=END IP CLONENUM_START=9 NETMASK=255.255.255.0 ARPCHECK=no
Again, save the file and restart the network or reboot and this subnet will start to work. You can do this with as many subnets as you like but you must make sure the CLONENUM_START field is unique as each range file will be assigned to the IP alias. In our examples eth0:0 and eth0:1.
If you need to specify custom fields like a BROADCAST field then you should follow the guide here on how to create separate interfaces.
How Was This Article?
You might also like
More from Dedicated Servers
Enable Mod_RemoteIP – See Visitors Real IP address when using Cloudflare & Apache
If you are using Cloudflare on your Apache server you will always see Cloudflare IPs in your logs and not …
Fix 413 Request Entity Too Large Errors When Using NGINX
Just like Apache, NGINX imposes default limits on the size of files that can be uploaded. A 413 Request Entity …
Cloud-init Modules That Automate and Customize Deployments
Cloud-init is a popular way to automate deployments of instances in a cloud or none cloud environment. To save having …