Ubuntu

How to Configure Static IP Address on Ubuntu 20.04?

The Internet Protocol (IP) address is an identifier between the Internet and network. It is the assigned unique number to every device and allows them to communicate with other networks. Your network can be accessed using the IP address.

The IP address has further two versions:

  • IPv4
  • IPv6

The nominated difference among these two versions is, IPv4 address has four (4) hexadecimal numbers and is separated by a full stop (.) like 192.16.18.0, whereas the IPv6 consists of 6 hexadecimal numbers separated by a colon (:) such as fe80::1615:5699:d8dd:ff04.

If we talk about the classifications of IP address, these are categorized into two parts:

  • Static IP Address
  • Dynamic IP Address

Most of the users prefer to use dynamic IP addresses, but sometimes, we need to convert them into static. As we all know, when the device is specified to a Static IP address, the address remains the same all the time. However, in Dynamic IP, the address changes over time while connecting with the server.

To assign a device as a static IP address, follow this guide until the end. We have several ways to set up a static IP address to a device, but we will go with the simplest two approaches:

  • Configure Static IP Address via GUI
  • Configure Static IP Address via Terminal

Let’s start with these two approaches!

How to Setup Static IP Address on Ubuntu 20.04 via GUI?

To set Static IP address through Graphical User Interface (GUI), navigate the cursor towards the top right bottom of the Ubuntu desktop and select the “Wired Settings” from the “Wired Connected” dropdown menu:

The “Network” interface will appear on the screen. Click on the “gear box” icon in the “Wired” section:

You will get the “Wired” interface window having all the details about the device network, as shown in the below image.

(So, the current IP address is 192.168.18.249)

Select the “IPv4” tab to configure the IP address:

In the IPv4 window, there are multiple options to set method, by default it selected as the “Automatic (DHCP)”. Set it to “Manual” to configure it manually:

The next step is to fill out the desired Static IP address, Netmask, and Gateway in the “Addresses” field and click to the “Apply” button:

If you want to assign more than one DNS address, then disable the “Automatic” toggle to configure it manually and move towards the “DNS” field and add multiple entries:

Once the settings are done, restart the network connection to apply the changes by clicking on the toggle first, to disable it, and then enable, to connect it again:

Click in the gear icon to check the new static IP address you applied:

The settings have been changed successfully.

How to Setup Static IP Address on Ubuntu 20.04 via Command-line?

Another way to configure the Static IP address is using the command line. Although there are multiple commands for this function as well, following this guide will give you the unique and simplest method through the “nmtui” command.

Type the “nmtui” command in the terminal to display the “Network Manager” interface:

In the given interface, navigate the cursor to the “Edit a connection” and enter it:

Next window will come up with the “Wire Connection 1” option. Select the “Edit” from its sub-menu:

Once you clicked, a window will appear to display the network details of the device, including the IP address, DNS server, and Gateway:

To configure the IP address manually, move the pointer towards the “Addresses” text box and enter the new Static IP address:

To restart the network, come back to the main window and select the “Activate a connection” option:

In the “Wired Connection 1” settings, deactivate it once and then reactivate it to make a connection again:

It will be changed successfully. To confirm it, go to the Network settings window and check if the new Static IP address has been updated:

You can also check it through the mentioned command:

$ ip a

Conclusion:

In this guide, we have checked how to configure the Static IP address. We have found two simplest ways from the numerous options. One is using GUI and another one is through the “nmtui” command.

Many users continue to work with dynamic IP addresses as the address changes with the time when the new connection with the server has been made. But most of the time, we need to change it with a Static IP address and doesn’t allow the IP address to change.

About the author

Syeda Wardah Batool

I am a Software Engineer Graduate and Self Motivated Linux writer. I also love to read latest Linux books. Moreover, in my free time, i love to read books on Personal development.