Hello Geeks, when we install Debian Linux on our system then during the installation it tries to get DHCP ip address from modem (or dhcp server) if available. But it is always to recommended to have a static IP address on your system. In this post, we will cover how to configure static IPv4 address in Debian 11 (Bullseye). In Debian Linux, there are two ways to set or configure static IP address.

Configure Static IP Address from GUI

Login to your Debian Desktop environment, From Settings –> Choose Network

Network-Settings-Debian11

Click on Wired Settings and then we will get the following window,

Details-Tab-Network-Settings-Debian-Linux

Note: To disable IPv6, go to IPv6 tab and choose ‘Disable’ option

Click on IPv4 Tab

Automatic-DHCP-Network-Debian-Linux

Above window shows that Automatic DHCP is configured, so to configure Static IP choose Manual and Specify the IP details like IP Address, Netmask, Gateway and DNS Server IP.

Note: To Specify the DNS Server IP first disable the automatic DNS IP by toggling it.

Set-Static-IPv4-GUI-Debian11

Click on Apply to save the changes.

Now, disable and enable the interface by toggling it so that new IP address is assigned to the Interface.

Disable-Enable-Interface-Toggle-GUI-Debian11

Now again click on wired settings to verify whether the new static ip address is assigned or not.

New-Static-IPv4-Debian11

Perfect, above confirms that new static IP address is configured successfully. Now let’s see the alternate way to configure IP address in Debian Linux.

Configure Static IP Address from Command Line

Open the terminal and identify the interface on which we will configure static IP address. Run below ip command,

$ ip add show

IP-Command-Interface-Name-debian

Now run nmcli command to get connection name,

$ nmcli connection

Once we get the connection name, run below nmcli command to assign static ipv4 address,

Syntax:

$ nmcli con mod  ‘connection-name’ ipv4.address  <IP-Address>

$ nmcli con mod 'eth0' ipv4.address 192.168.1.151/24

Set the gateway by running below

$ nmcli con mod 'eth0' ipv4.gateway 192.168.1.1

Change Configuration from DHCP to Manual , so that IP will be static and persistent, run

$ nmcli con mod 'eth0' ipv4.method manual

Set the DNS Server IP by running below command,

$ nmcli con mod 'eth0' ipv4.dns '8.8.8.8'

Disable and enable the connection so that above changes come into the effect.

$ nmcli connection down eth0
$ nmcli connection up eth0

Now Run IP Command to check IP address,

$ ip add show eth0

Output of above commands would look like below:

Configure-Static-IP-with-nmcli-command-Debian11

Perfect, above output confirms that static IP address has been configured successfully on eth0 interface. That’s all from this article. Please do share your feedback and queries in below comments section.

The post How to Configure Static IP Address in Debian 11 (Bullseye) first appeared on LinuxTechi.

Leave a Comment