How to configure additional IPs on Debian 11
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 213.186.33.99 8.8.8.8 2001:4860:4860::8888
dns-search f2h.cloud
auto eth0
iface eth0 inet static
address 198.244.174.1/28
gateway 198.244.200.254
# 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 198.244.174.1 and an IPv6 of 2001:41d0:800:3d92::1b31. We have our gateways specified already. Let’s assume we want to add the 198.220.120.1/30 IP block. That’s 4 additional IPs. All we need to do is specify those IPs in this file.
Configure Additional IPs Debian 11
So to add additional IPs to this Debian instance, add those IPs to the eth0 interface. You 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.
nano /etc/network/interfaces.d/50-cloud-init
auto lo
iface lo inet loopback
dns-nameservers 213.186.33.99 8.8.8.8 2001:4860:4860::8888
dns-search f2h.cloud
auto eth0
iface eth0 inet static
address 198.244.174.1/28
gateway 198.244.200.254
# Add additional /30 IP block
iface eth0 inet static
address 198.220.120.1/30
iface eth0 inet static
address 198.220.120.2/30
iface eth0 inet static
address 198.220.120.3/30
iface eth0 inet static
address 198.220.120.4/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 Debian NVMe VPS server and those IPs will now resolve. Changes made in this file will persist over reboots.