Linux Mint

How to configure Static IP Address on Linux Mint

By default, your system is based on DHCP, a dynamic host control protocol, and its role is to provide you with the available IP address automatically. So, in DHCP, every device is given a unique number that allows it to interact with other networks, and as a result, your device’s IP address may vary from time to time.

But sometimes, you need a static IP address, and it is required to maintain the same IP address for an extended period. For example, if you configure your system to make it a server, static IP is necessary for communication purposes. You need to make sure that your computer’s IP address never changes if you want people to download files from it. Also, static IP is necessary if you want to access any external shared device such as a printer.

A static IP address can be configured in three ways:

  1. Configuration using GUI
  2. Configuration using a terminal
  3. Configuration through modifying the network configuration file

Configuration of Static IP using GUI on Linux Mint

Configuring static IP on your Linux mint OS by this method is quite simple, and for that, you need to select the network settings from the menu and click on the network icon as shown below.

Graphical user interface Description automatically generated

After going into the network settings, you will see the basic details of your currently established network and the IP address assigned by the DHCP network. So you can change that to a static ip address by clicking on the settings tab available on the bottom left.

Graphical user interface, text, application Description automatically generated

Now you need to change the “automatic (DHCP)” address to” Manual”.

Graphical user interface, text, application Description automatically generated

After selecting the manual option, it will ask you to enter the new network settings that you desire, as displayed below. You need to input the values and then click on the apply button to implement those settings. The IP address 192.168.114.100 would be the static IP, also set network mask and gateway.

Graphical user interface, application Description automatically generated

Now you need to go back to the main window of the network settings to see newly applied settings.

Graphical user interface, application Description automatically generated

Configuration of Static IP using terminal on Linux Mint

You can also configure static IP using command-line interface (CLI), and for that, you need to type the command:

$ nmtui

This will open a new window with various options, and then you need to select the first one, “Edit a Connection” to apply the new settings that can be seen below.

Graphical user interface Description automatically generated

A picture containing PowerPoint Description automatically generated

The next step is to change “IPv4 CONFIGURATION” from automatic to Manual and then you need to provide the necessary details to make this work.

Text Description automatically generated

We have applied the same network values that we have used in our first scenario

A picture containing timeline Description automatically generated

Now save these settings, go back to the main window, and select the second option below.

The first option is used to change your network settings, and the second option of “Activate the connection” is used to apply those settings. You need to open it, click on the “Deactivate” button, and then “Activate” it again which will restart your network so that the new settings can be applied.

Graphical user interface, text, application Description automatically generated

So if you want to verify whether the new network settings have been implemented, you can do that by typing the below-mentioned command in the terminal.

$ ip a

Text Description automatically generated

You can see from the above image that the newly applied IP address is currently active and working that you can see on the “ens33” field, which is a network interface where the information of Ipv4 resides.

Configuration of Static IP through network configuration file on Linux Mint

You can also set static IP by doing some modifications on the network configuration file and for that, you need to open this file with an editor of your choice:

$ sudo nano etc/network/interfaces

From the above command, we are using a nano editor, and after opening this file, you need to write a few lines described below, and after that, you need to save the file.

auto enp0s3

iface enp0s3 static

address: 192.168.114.100

netmask: 255.255.255.0

gateway: 192.168.114.2

dns-nameservers 8.8.8.8

Text Description automatically generated

Now you should be able to access your newly applied network settings and verify this by typing again.

$ ip a

Text Description automatically generated

You can also verify if the new route settings have been implemented or not by typing.

$ route -n

Text Description automatically generated

Conclusion

Your Linux Mint operating system is configured to DHCP by default, which means that your machine’s IP address might change automatically to a different accessible IP address. However, there are times when you require a constant IP address, such as when communicating with a server. So, this is where static IP comes into play; with it, your IP address will not change automatically and will remain the same until it is altered by someone else or reverted to DHCP.

About the author

Taimoor Mohsin