Configure additional IPs Debian Ubuntu KVM VPS
Configure additional IPs Debian Ubuntu. This setup guide relates to our network and will not work with other providers. This is the manual way of configuring additional IPs. From 14/03/2017 customers can click the “reconfigure networking” button inside your control panel to automatically configure any additional IPs. You must be using the Virtio NIC card for this to work.
For CentOS please see Configure Addional IPs – CentOS
Because of our network configuration and the way KVM VPS servers are built, to get any additional IPs or subnets to ping inside your virtual container and be accessible from the outside you need to add separate network interfaces for each additional IP.
Debian, Ubuntu, Fedora
First, backup the network configuration file so we can revert back to it should there be any issues.
cp /etc/network/interfaces /etc/network/interfaces.bak
Next, edit the file with a program like nano or vi;
Then, add the secondary interface exactly below. You can just copy the code to the file but remember to replace the IP sections with your additional IP details.
auto eth0:0 iface eth0:0 inet static address YOUR_ADDITIONAL_IP netmask 255.255.255.255
To make sure any secondary interface(s) is brought up when the eth0 is activated we must add the following line to the eth0 configuration file:
post-up /sbin/ifconfig eth0:0 YOUR_ADDITIONAL_IP netmask 255.255.255.255 broadcast YOUR_ADDITIONAL_IP pre-down /sbin/ifconfig eth0:0 down
Configure Multiple IPs
So, you can configure multiple IPs in your KVM VPS or Dedicated server by adding them all to the interfaces file. Each of your IPs will have an interface at the top and a postup and postdown script at the bottom. So, if you have 8 IPs you would have 16 sections in the file.
auto eth0 iface eth0 inet static address YOUR_VM_IP netmask 255.255.255.0 broadcast xxx.xxx.xxx.255 gateway xxx.xxx.xxx.254 auto eth0:0 iface eth0:0 inet static address YOUR_IP1 netmask 255.255.255.255 auto eth0:1 iface eth0:1 inet static address YOUR_IP2 netmask 255.255.255.255 post-up /sbin/ifconfig eth0:0 YOUR_IP1 netmask 255.255.255.255 broadcast YOUR_IP1 pre-down /sbin/ifconfig eth0:0 down post-up /sbin/ifconfig eth0:1 YOUR_IP2 netmask 255.255.255.255 broadcast YOUR_IP2 pre-down /sbin/ifconfig eth0:1 down
Restart your network interfaces to activate the new Failover IPs
sudo /etc/init.d/networking restart
How was this article? Configure additional IPs Debian Ubuntu KVM VPS
More from Dedicated Servers
If you are using Cloudflare on your Apache server you will always see Cloudflare IPs in your logs and not …
Cloud-init is a popular way to automate deployments of instances in a cloud or none cloud environment. To save having …