How to Configure Static IP Address in Debian 11 (Bullseye)
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
Click on Wired Settings and then we will get the following window,
Note: To disable IPv6, go to IPv6 tab and choose ‘Disable’ option
Click on IPv4 Tab
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.
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.
Now again click on wired settings to verify whether the new static ip address is assigned or not.
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
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,
$ 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 '22.214.171.124'
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:
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.