×


Configure Static IP in Debian 10 - Step by step process to do it ?

When you install a new OS, by default it is configured to obtain a dynamic IP address from the DHCP server. 

However, sometimes you have to configure the static IP address on your machine. 

It can be for various reasons like when a service needs to connect through an IP address instead of a domain name or when you are hosting a web server or to give someone remote access to your system. 

Whatever the reason is, you must know how to configure a static IP in your system. 

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to configure packages on their Linux Server.

In this context, we shall look into how to set up a static IP in your Linux system. 


How to Configure Static IP in Debian 10?

You can configure static IP in Debian 10 system using any of the following methods:

i. Configure Static IP via Command Line

ii. Configure Static IP via GUI

Now, Let's get started.


1. How to Configure Static IP via Command Line ?

You can configure the static IP through /etc/network/interfaces file from your command line. 

However, for this, you first need to know the network interface name.

i. You can find the currently available network interface by running the below command in Terminal:

$ ip a

"ip a" command shows that there are two interfaces currently available. 

We want to configure the static IP for the interface ens33

Let's say that the current IP address of ens33 is 192.168.72.150 which is dynamically assigned by the DHCP.

Now we will open the interface configuration file and configure static IP for ens33.

ii. To open network interface configuration file, execute the following command:

$ sudo nano /etc/network/interfaces

iii. Then add lines in the following syntax replacing the interface with your network interface name and xxx.xxx.xxx.xxx with the relevant IP address:

auto interface
iface interface inet static
address xxx.xxx.xxx.xxx #enter your IP address
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx #enter gateway ip address
dns-nameservers xxx.xxx.xxx.xxx

iv. For our network interface ens33, we have modified the configuration lines as follows:

auto ens33
iface ens33 inet static
address 192.168.72.150
netmask 255.255.255.0
gateway 192.168.72.2 
dns-nameservers 8.8.8.8 8.8.4.4

v. Once you have completed the configurations, save and close the file.

vi. Then restart the networking services. Use the below command to do so:

$ sudo systemctl restart networking.service

vii. You can also use the ifdown and ifup command to apply the configuration changes. First, run the ifdown command to bring down the interface:

$ ifdown ens33

viii. Then bring up the interface using ifup:

$ ifup ens33

ix. Now to verify if the IP address has been changed successfully, issue the below command in Terminal:

$ ip a


2. How to Configure Static IP via GUI ?

You can also change the static IP through the Settings utility in your Debian system. 

i. To launch the Settings utility in your system, right-click the desktop and then click Settings.

ii. Then from the left pane in the Settings window, select the Network tab.

iii. On the right pane, click the cog icon in front of the network interface you want to configure.

iv. You will see a configuration window where you will see the current IP 192.168.72.150 which is the IP address obtained from DHCP server. 

Go to IPv4 tab.

v. Then in the IPv4 Method, choose Manual.

Now the Addresses field will appear. Enter the IP address, Netmask, and Gateway for your interface. If you also want to set the DNS address manually, switch off the Automatic button and enter the DNS server address.

Here, we have specified 192.168.72.150 as our interface IP address, 255.255.255.0 as netmask, and the 192.168.72.2 ad the default gateway. 

Then we have specified 8.8.8.8 and 8.8.4.4 as our DNS servers.

vi. Now click the Apply button to apply all the configuration changes.

vii. Now to confirm if the new IP address has been successfully configured, go to the Details tab. 

Alternatively, you can also use the "ip a" command in Terminal to verify the IP address.


[Need urgent assistance to set up Static IP address on your Linux Server? We are available to help you today. ]


Conclusion

This article will guide you on the how to set up a static IP configuration in #Debian 10. Using either the command line or #GUI method, you can easily configure the static IP address on your system.

The ifconfig utility is used to change the IP address of a network interface.

To change your #IP address on #Linux, use the “ifconfig” command followed by the name of your network interface and the new IP address to be changed on your computer. 

To assign the subnet #mask, you can either add a “netmask” clause followed by the subnet mask or use the CIDR notation directly.

To Configure static IP address on Ubuntu 16.04 LTS Server:

1. Edit the /network/interfaces file. sudo nano /etc/network/interfaces.

2. Restart the networking service (or reboot) Once you are confident the change has been made, and if you don't want to reboot you can just restart the networking service.

To Display Available Network Interfaces in Linux:

i. ip #command – It is used to show or manipulate routing, devices, policy routing and tunnels.

ii. #netstat command – It is used to display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.

iii. #ifconfig command – It is used to display or configure a network interface.