Debian

How to Configure Multiple IP Adresses on a Single Network Interface on Debian 12 Desktop/Server

Usually, you set a single IP address on a single network interface of your Debian 12 desktop/server operating system. At times, you may need multiple IP addresses to be set on your Debian 12 system, but you may not have multiple network interfaces installed on your computer. If that’s the case, you can set multiple IP addresses on a single network interface of your Debian 12 system very easily.

In this article, we will show you how to configure the multiple IP addresses on a single network interface of the Debian 12 desktop and Debian 12 server operating systems.

Topic of Contents:

Configuring Multiple IP Addresses on a Single Network Interface of the Debian 12 Desktop

If you’re using the Debian 12 desktop operating system, you can use the Network Manager command line tool which is “nmcli” to configure multiple IP addresses on a single network interface very easily. The process of setting up multiple IP addresses in a single network interface using the Network Manager command line tool which is “nmcli” is the same as setting up a fixed IP address. So, in this section, we will only show you the differences. For more information, read the article on How to Assign a Fixed IP Address on Debian 12.

To find the name of the Network Manager connection that you want to configure in multiple IP addresses, run the following command:

$ nmcli connection

 

The Network Manager connection name should be “Wired connection 1” if you have a single network interface on your Debian 12 desktop system.  In our case, the Network Manager connection “Wired connection 1” is managing the physical network interface which is “ens32”.

To configure the Network Manager connection “Wired connection 1”, run the following command:

$ nmcli connection edit "Wired connection 1"

 

The Network Manager connection editor should be opened.

First, you have to reset the IP address that you already set on the network manager connection.

To do that, run the following command:

$ set ipv4.addresses

 

Once you’re prompted to enter an IP address, just press <Enter>.

As you can see, no IP address is set for the Network Manager connection.

$ print ipv4.addresses

 

To set the 192.168.189.51, 192.168.189.52, and 192.168.189.53 IP addresses and a 24-bit subnet mask for all of them, run the following command:

$ set ipv4.addresses 192.168.189.51/24,192.168.189.52/24,192.168.189.53/24

 

To save the changes, run the following command:

$ save persistent

 

To apply the network changes, run the following command:

$ activate

 

To exit out of the Network Manager connection editor, run the following command:

$ quit

 

As you can see, the 192.168.189.51, 192.168.189.52, and 192.168.189.53 IP addresses are set for the “ens32” network interface (which is managed by the Network Manager connection “Wired connection 1”).

$ ip a

 

Configuring Multiple IP Addresses on a Single Network Interface of the Debian 12 Server

If you’re using the Debian 12 server operating system, you have to use the /etc/network/interfaces file to configure multiple IP addresses on a single network interface. The process of setting up multiple IP addresses in a single network interface using the /etc/network/interfaces file is the same as setting up a fixed IP address. So, in this section, we will only show you the differences. For more information, read the article on How to Assign a Fixed IP Address on Debian 12.

To find the name of the network interface that you want to configure in multiple IP addresses, run the following command:

$ ip a

 

In our case, the network interface name is “ens32” as you can see in the following screenshot:

Open the /etc/network/interfaces file with the nano text editor as follows:

$ sudo nano /etc/network/interfaces

 

Type in the marked lines to configure the 192.168.189.51, 192.168.189.52, and 192.168.189.53 IP addresses and a 24-bit subnet mask (for all of them) for the “ens32” network interface.

  • These lines are used to configure a static/fixed IP address of 192.168.189.51 for the “ens32” network interface.
  • These lines are used to configure the IP address of 192.168.189.52 for the “ens32” network interface.
  • These lines are used to configure the IP address of 192.168.189.53 for the “ens32” network interface.

Once you’re done with the configuration, press <Ctrl> + X followed by Y and <Enter> to save the changes.

For the changes to take effect, restart the networking service of your Debian 12 server system with the following command:

$ sudo systemctl restart networking.service

 

As you can see, the 192.168.189.51, 192.168.189.52, and 192.168.189.53 IP addresses are set for the “ens32” network interface.

$ ip a

 

Conclusion

In this article, we showed you how to configure the multiple IP addresses on a single network interface of the Debian 12 desktop system using the Network Manager command line tool which is “nmcli”. We also showed you how to configure multiple IP addresses on a single network interface of the Debian 12 server system using the /etc/network/interfaces file. For more information on setting a static/fixed IP address on the Debian 12 desktop/server system, read this article.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.