When you install a new operating system on your computer, the DHCP server assigns you a dynamic IP address. However, you may need to set up a static IP address on your machine in various situations, such as when you are hosting a web server, or any service requires an IP address rather than a domain name, or in a case where you are about to grant someone remote access to your system. Whatever the reason is, you should know how to set up a static IP address on your system.

In this post, you will learn how to set up static IP on Debian 11 using two different methods. So, let’s start!

Method 1: Set up a static IP address on Debian 11 using terminal

As a Debian user, you can easily set up a static IP by using your terminal. To do so, firstly, you have to select an active network interface on your system.

How to check available network interfaces on Debian 11

You can utilize the “ip” command to get the details about your system’s currently available network interfaces. The “ip” is an abbreviation for “Internet Protocol”. The “ip” command is a utility used by network and system administrators in Linux-based systems to configure network interfaces. In the “ip” command, “link” is the sub-command added to view and modify the network interface. Write out the below-given command in your Debian 11 terminal for viewing the currently available network interfaces:

From the output, we will note down the name of our active network interface, which is “enpos3”. As “enpos3” is the network interface for which we will set up a static IP:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-1.png" data-lazy- height="292" src="data:image/svg xml,” width=”742″>

How to set up a static IP address on Debian 11

Now, open the configuration file of the network interfaces “/etc/network/interfaces” in the nano editor:

$ sudo nano /etc/network/interfaces

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-2.png" data-lazy- height="201" src="data:image/svg xml,” width=”776″>

With the default settings, your network interfaces configuration file will look like this:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-3.png" data-lazy- height="487" src="data:image/svg xml,” width=”776″>

In the “/etc/network/interfaces” file, add the following details about your network interface, such as its static IP address, which you want to set up, netmask, gateway, dns-nameservers:

auto enp0s3


iface enp0s3 inet static


address 192.168.2.2


netmask 255.255.255.0


gateway 192.168.2.2


dns-nameservers 8.8.4.4 8.8.8.8

Here, the first two lines declare that we are setting a static IP address for the “enpos3” network interface:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-4.png" data-lazy- height="486" src="data:image/svg xml,” width=”777″>

To save the changes you have made in the network interface configuration file, press “CTRL O”:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-5.png" data-lazy- height="488" src="data:image/svg xml,” width=”778″>

How to restart the networking service on Debian 11

After configuring the static IP address for the “enpos3” network interface, now we will restart the networking service using the systemctl command:

$ sudo systemctl restart NetworkManager.service

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-6.png" data-lazy- height="181" src="data:image/svg xml,” width=”741″>

You can verify if your Debian system has configured the static IP for your selected network interface:

From the output, you can see that we have successfully configured static IP address our “enpos3” network interface to “192.168.2.2”:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-7.png" data-lazy- height="488" src="data:image/svg xml,” width=”743″>

Method 2: Set up a static IP address on Debian 11 using GUI

Debian 11 also provides you the facility to set the static IP address of your active network interface using its GUI. If you want to utilize the Debian GUI method for configuring the static IP address, then open your system settings by searching “settings” in the Application’s bar:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-8.png" data-lazy- height="451" src="data:image/svg xml,” width=”1133″>

From the different categories present in the left side menu, select “Network”. Open settings of your active network connection by clicking on the gear icon:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-9.png" data-lazy- height="638" src="data:image/svg xml,” width=”987″>

In the opened network settings window, click on the “IPv4” tab. Select the “Manual” IPv4 method for your network:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-10.png" data-lazy- height="644" src="data:image/svg xml,” width=”1005″>

After that, add your static IP address, Netmask, Gateway, DNS for your network, and then click on the “Apply” button:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-11.png" data-lazy- height="641" src="data:image/svg xml,” width=”988″>

Now, open the “Details” tab. Here, you will verify the added details for your network, such as its IP address:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/10/echo/How-to-set-up-a-static-IP-address-on-Debian-11-12.png" data-lazy- height="638" src="data:image/svg xml,” width=”989″>

That’s how you set up the static IP address for your network interface on Debian 11 using its GUI.

Conclusion

Debian 11 provides you the option to set up a static IP address for your system, whether you want to do it for hosting your web server or granting remote access to anyone. DHCP automatically enables a dynamic server when you install a new operating system. However, you can configure your IP address using Debian terminal and GUI. In this post, you have learned how to set up a static IP address on your Debian 11 using two different methods.