Debian is popular for hosting websites, management, and more. In most cases, Debian is not used for desktop purposes; it's primarily used for hosting and server applications. In this tutorial, I will guide you on how to add a static IP address on Debian.

If you are using a DHCP network connection, your IP address may change after restarting your Debian server. In this case, you can manually set a static IP address for Debian using the terminal. To do this, first, you need to check your network hardware name, router gateway, netmask, and DNS servers. All this information is available from your router. To check your hardware name, input ip a in the terminal.

check current networking hardware using "ip a" command

From the output, you can see that my current network hardware is enp6s18. You will see your own hardware name. After checking this, you can go to the network configuration file via terminal using the following command:

$ sudo nano /etc/network/interfaces

In the network configuration file, we need to add the given networking information manually.

# The primary network interface auto enp6s18 iface enp6s18 inet static address 192.168.100.10 netmask 255.255.255.0 gateway 192.168.100.1 dns-nameservers 8.8.8.8 dns-nameservers 1.1.1.1
add static ip on debian

In the network configuration file, we need to add the given networking information manually. Here, you can input all information according to your hardware. Your networking information will be different. Once you've input all your information, press ctrl + O to save all the changes and ctrl + X to exit from the configuration file. Now, restart the networking service:

$ sudo systemctl restart netowrking

We have successfully set up the static IP address on the Debian system. To verify, input "ip a" in the terminal.

static ip set successfully on debian

From the output, you can see that I have set the static IP address "192.168.100.20/24" on my system.

The link has been copied!