To setup the LAN or additional IP addresses on your Linux server , start by opening up the Manage page for the server to be configured. Note down the LAN IP if you are setting up the internal LAN between two or more servers, and the Secondary IP(s) that were assigned to your server if you will be configuring your additionally purchased IP addresses.

 

Note for cPanel users: Please refer to the cPanel documentation for instructions and requirements for adding IP addresses to a server running cPanel.


Note: Replace $SECONDARY_IP$ below with the Seconday IP(s) you noted down in mPanel. The gateway address is the first three octets of your $SECONDARY_IP$ address being added, and replacing the last(fourth) octet with 1.

Example: Adding the IP address 103.1.165.254 would use the gateway address 103.1.165.1


Notes:

  • Replace $ADDITIONAL_IP$ below with the Seconday IP(s) or LAN IP you noted down in mPanel.
  • The gateway address uses the first three parts of the $ADDITIONAL_IP$ address being added, and replaces the last number with 1.
  • The netmask on a LAN IP will be 255.255.0.0 and the netmask on Secondary IP(s) 255.255.255.0

Examples:

  • Adding the IP address 103.1.165.254 would use the gateway address 103.1.165.1 and netmask 255.255.255.0
  • Adding the LAN IP address 172.20.165.254 doesn't require a gateway address and would use the netmask 255.255.0.0


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.255.0
gateway XXX.XXX.XXX.1

Activate the interface by 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
GATEWAY=XXX.XXX.XXX.1
NAME=eth0:0

Activate the interface by 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

openSUSE


Using sudo, edit the configuration file /etc/sysconfig/network/ifcfg-eth0 and append the following to the file:

IPADDR1=$ADDITIONAL_IP$
NETMASK1=255.255.255.0
LABEL1=0

Activate the interface by running the following command:

sudo /etc/init.d/network restart

Adding more IP addresses to your server simply requires editing the same /etc/sysconfig/network/ifcfg-eth0 file.

IPADDR2=$ADDITIONAL_IP2$
NETMASK2=255.255.255.0
LABEL2=1
IPADDR3=$ADDITIONAL_IP3$
NETMASK3=255.255.255.0
LABEL3=2

Activate the additional interfaces by running the following command:

sudo /etc/init.d/network restart