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.

ip addr

Check current IP address setup

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,

ip addr

assign new IP address with ip command

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.

Assign IP addresses permanently

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.

nano /etc/network/interfaces

Below is the sample output.

Edit the interfaces file

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.

Add new network card configuration

Restart the networking service by running the following command.

systemctl restart networking

Check the IP addresses by executing the following command.

ip addr

As you can see from the above screenshot, the new IP address has been assigned.

Conclusion

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.

How to assign multiple IP addresses to single LAN card in Debian 10

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn