On Debian 11 instances, we removed the /etc/network/interfaces file and now configure interfaces using Cloud-init on boot. Discovery will send a snippet of data to the network, including the location of your hard drive, assigned IPs, number of CPUs and Ram to name a few things. This information is configured during the boot phase. If you reboot a Debian 11 instance and use the NoVNC or xTerm consoles, you will see the process in the console at startup.
Because of this change, customers with an NVME VPS Server or High Avaliabliltuy VPS Server do not need to worry about static routes, gateways or netmasks. To add additional IPs to Debian 11 instances you just specify the IPs routed to the instance. Let’s take a closer look at this.
Debian 11 Interfaces & Cloud-init
On Debian 11. The interfaces file located at /etc/network/interfaces is supposed to be empty. The configuration file for the networking is located at /etc/network/interfaces.d/50-cloud-init. Let’s open up that file.
auto lo iface lo inet loopback dns-nameservers 18.104.22.168 22.214.171.124 2001:4860:4860::8888 dns-search f2h.cloud auto eth0 iface eth0 inet static address 126.96.36.199/28 gateway 188.8.131.52 # control-alias eth0 iface eth0 inet6 static address 2001:41d0:800:3d92::1b31/122 gateway 2001:41d0:0800:3dff:ff:ff:ff:ff
As you can we, we have our eth0 interfaces configured with IPv4 184.108.40.206 and an IPv6 of 2001:41d0:800:3d92::1b31. We have our gateways specified already. Let’s assume we want to add the 220.127.116.11/30 IP block. That’s 4 additional IPs. All we need to do is specify those IPs in this file.
Configure Additional IPs in Debian 11
So to add additional IPs to this Debian instance, I will add those IPs to the eth0 interface. I don’t need to specify any special routing or gateways. We strategically route additional IPs to your server’s MAC address making this super easy.
auto lo iface lo inet loopback dns-nameservers 18.104.22.168 22.214.171.124 2001:4860:4860::8888 dns-search f2h.cloud auto eth0 iface eth0 inet static address 126.96.36.199/28 gateway 188.8.131.52 # Add additional /30 IP block iface eth0 inet static address 184.108.40.206/30 iface eth0 inet static address 220.127.116.11/30 iface eth0 inet static address 18.104.22.168/30 iface eth0 inet static address 22.214.171.124/30 # control-alias eth0 iface eth0 inet6 static address 2001:41d0:800:3d92::1b31/122 gateway 2001:41d0:0800:3dff:ff:ff:ff:ff
Once any additional IPs have been specified in the file, save and close. Reboot the server and those IPs will now resolve. Changes made in this file will persist over reboots.
How was this article? – How to configure additional IPs in a Debian 11 VPS
More from Linux VPS Servers
Over the years we have invested a lot of money in ensuring our network is as resilient as possible. Things …