To setup the LAN or additional IP addresses on your Linux VPS, start by opening up the Manage page for the VPS to be configured. Note down the Mammoth LAN IP if you are setting up the internal LAN between two or more VPS, and the Secondary IP(s) that were assigned to your VPS 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 VPS running cPanel.
Notes:
- Replace $ADDITIONAL_IP$ below with the Seconday IP(s) or Mammoth 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 ifup eth0:0
If adding more IP addresses to your VPS, you could follow the same naming convention: eth0:1 eth0:2 and so on. Activating them in the same way:
sudo ifup eth0:1 sudo ifup eth0:2
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 VPS, 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 VPS 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
Comments