Sometimes you may require multiple IP addresses on your machine, e.g. when testing things or when you run a server that is connected to multiple networks. It is often impractical to buy multiple network cards, plug them into your server and separately assign them IP addresses. However, with the help of this tutorial, you can assign multiple IP addresses to a single LAN card in Debian version 10.
Assigning multiple IP addresses temporarily
First, let’s find out the interface name. Execute the following command on the terminal.
As you can see from the above screenshot, the machine has a single interface ens33 and it has already assigned IP address 192.168.227.143/24. Let us assign one more IP address 10.1.1.2/8 to this interface.
Execute the following command on the terminal with root privileges.
ip addr add 10.1.1.2/8 dev ens33
Again run the following command to confirm,
As you can see from the above screenshot, the new IP address has been assigned. As soon as you turn off or restart your system, this IP address will be automatically removed.
Assigning multiple IP addresses permanently
First of all, find out the interface name and already assigned IP addresses.
As you can see from the above screenshot, there is already a single IP address assigned and the interface name is ens33.
Run the following command with root privileges to open a network configuration file.
Below is the sample output.
Put the following lines and close the file.
iface ens33 inet static address 10.1.1.1/8
Below are the contents of a configuration file.
Restart the networking service by running the following command.
systemctl restart networking
Check the IP addresses by executing the following command.
As you can see from the above screenshot, the new IP address has been assigned.
So that was a small tutorial on assigning multiple IP addresses to a single interface in Debian 10. Good luck with implementing the above commands.