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

s2 0

Sometimes you may need multiple IP addresses on your computer, e.g. For example, when you test things or run a server that is connected to multiple networks. It is often inconvenient to buy multiple network cards, connect them to your server, and assign them IP addresses separately. However, with the help of this tutorial you can assign multiple IP addresses to a single LAN card in Debian version 10.

Temporarily assign multiple IP addresses

Let’s find out the interface name first. Run the following command on the terminal.

ip addr

As you can see from the screenshot above, the machine has a single interface ens33 and has already assigned the IP address 192.168.227.143/24. Let’s assign another IP address 10.1.1.2/8 to this interface.

Run the following command on the terminal with root privileges.

ip addr add 10.1.1.2/8 dev ens33

Run the following command again to confirm

ip addr

As you can see in the screenshot above, the new IP address has been assigned. As soon as you turn off or restart your system, this IP address is automatically removed.

Permanently assign multiple IP addresses

First determine the interface name and the already assigned IP addresses.

Permanently assign IP addresses

As you can see from the screenshot above, a single IP address is already 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 interface file

Add the following lines and close the file.

iface ens33 inet static
  address 10.1.1.1/8

Below you will find the contents of a configuration file.

Add new network card configuration

Restart the network service by running the following command.

systemctl restart networking

Check the IP addresses by running the following command.

ip addr

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

diploma

So that was a little tutorial on assigning multiple IP addresses to a single interface in Debian 10. Good luck implementing the commands above.

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