To setup the load balancer IP, or secondary IP addresses on your Linux server, start by opening up the Manage page for the server to be configured. Note down the Secondary IP(s) that were assigned to your server if you will be configuring your additionally purchased IP addresses, or the load balancer IP, if the server has been added to a load balancer service.
Note for cPanel users: Please refer to the cPanel documentation for instructions and requirements for adding IP addresses to a server running cPanel.
Notes:
- Replace $ADDITIONAL_IP$ below with the Secondary IP(s) or load balancer IP you noted down in mPanel.
- The netmask on a LAN IP will be 255.255.0.0; the netmask on Secondary IP(s) 255.255.240.0; and the netmask on Load Balancer IP is 255.255.255.255
Examples:
- Adding the IP address 103.1.165.254 would use netmask 255.255.240.0
- Adding the Load Balancer IP 112.213.37.254 would use the netmask 255.255.255.255
Debian/Ubuntu
Using sudo edit the configuration file /etc/network/interfaces and append the following to the file:
auto eth0:0 iface eth0:0 inet static address $ADDITIONAL_IP$ netmask 255.255.240.0
Activate the interface by rebooting or running the following command:
sudo /etc/init.d/networking restart
You can name your interfaces in a manner you find easier to identify. e.g. eth0:LAN or eth0:SSL
Fedora / CentOS
Using sudo, create the configuration file /etc/sysconfig/network-scripts/ifcfg-eth0:0 with the following:
DEVICE=eth0:0 BOOTPROTO=none ONPARENT=yes TYPE=Ethernet IPADDR=$ADDITIONAL_IP$ NETMASK=255.255.255.0 NAME=eth0:0
Activate the interface by rebooting or running the following command:
sudo /etc/init.d/network restart
If adding more IP addresses to your server, you could follow the same naming convention: eth0:1 eth0:2 and so on. A network script will need to be created for each additional address. e.g.
/etc/sysconfig/network-scripts/ifcfg-eth0:1 /etc/sysconfig/network-scripts/ifcfg-eth0:2
Activate the additional interfaces that were created by running the following command:
sudo /etc/init.d/network restart