Categories: Ubuntu

Setting Up Static IP Address on Ubuntu 22.04 LTS

Linux-based systems such as Ubuntu 22.04 offer two major options for configuring the network interfaces when it comes to IP addresses. You can either utilize DHCP to get an IP address automatically or set a Static IP Address that will never change. More specifically, setting Static IP address assists in granting someone remote access or in a situation when you want to host a web server.

This write-up will discuss the procedure of setting a Static IP address on Ubuntu 22.04 using two different methods. So, let’s start!

Set Static IP Address using nmcli command on Ubuntu 22.04

In the terminal, you can utilize the “nmcli

Sponsored
command to set up a Static IP Address on Ubuntu 22.04. The “nmcli” command enables Linux users to control the “NetworkManager”. It can be also used for printing the status of network device status, creating, modifying, deleting, activating, or deactivating network connections.

For setting up a Static IP Address using the “nmcli” command, follow the below-given step-by-step procedure.

Step 1: Check device name
Firstly, press “CTRL+ALT+T” to open up the terminal and then run the following “nmcli” command to check the device name:

$ nmcli connection show

The given output shows that our device name is “enp0s3”:

Step 2: Create a Static connection
In the next step, we will create a new static connection named “static ip” for the “enp0s3” device:

$ sudo nmcli con add type ethernet con-name ‘static-ip’ ifname enp0s3 ipv4.method manual ipv4.addresses 192.168.1.102/24 gw4 192.168.1.1

Step 3: Add DNS IP to static-ip
Then, execute the below-given command for adding the DNS IP to the “static-ip” connection:

$ sudo nmcli con mod static-ip ipv4.dns 192.168.1.1

Step 4: Activate the Static connection
Make sure that the created “static-ipconnection is active and working on your Ubuntu 22.04:

$ sudo nmcli con up id ‘static-ip’

The below-given output indicates that our “static-ip” connection is successfully activated:

Step 5: Verify the IP assignment to the selected device
Now, execute the “ip” command with the “a” option to validate the IP assigned to the “enp0s3” device:

$ ip a

Lastly, verify the internet connectivity with the help of the following “ping” command:

$ ping google.com

As you can see, the given output validates that the configured “static-ip” connection is working perfectly:

Now, let’s check out the GUI method for setting up Static IP Address on Ubuntu 22.04.

Sponsored

Set Static IP Address using GUI on Ubuntu 22.04

Some Linux users prefer to utilize GUI instead of the terminal for the tasks related to network configuration. Are you one of them? If yes, then look at the below-given instructions for setting up a Static IP Address on Ubuntu 22.04 using GUI Network Settings.

First of all, click on the “network” icon that is present at the top-right side of your Ubuntu 22.04 desktop screen:

From the opened menu, select the “Wired Settings” option:

A Network Settings window will appear on your screen. Now, click on the “gear” icon that is located on the right side of your network connection:

Upon doing so, you will see the following dialog box:

Switch to the “IPv4” tab of the opened dialog box, select “Manual” as the “IPv4 Method” and then enter values for “Address”, “Network”, “Gateway” and “DNS”. After doing so, click on the “Apply” button:

In the next step, click on the highlighted “switch” to restart the network:

Lastly, verify the newly set configuration by clicking on the “gear” icon:

The above-given network connection details indicate that we have successfully set the Static IP Address on our Ubuntu 22.04 system.

Conclusion

On your Ubuntu 22.04 system, you can utilize the “nmcli” command in the terminal for setting a static IP Address. In the other case, you can configure a Static IP Address using the Network Settings of the selected Wired Connection. This write-up discussed the methods to set up a Static IP Address on Ubuntu 22.04.

Ubuntu Server Admin

Recent Posts

Ubuntu Command-Line Mastery: The Essential Guide for Power Users

The Linux terminal is a powerful tool allowing users to control their system precisely and…

12 hours ago

Ubuntu Weekly Newsletter Issue 876

Welcome to the Ubuntu Weekly Newsletter, Issue 876 for the week of January 19 –…

3 days ago

How to utilize CPU offloads to increase storage efficiency

Canonical Ceph with IntelⓇ Quick Assist Technology (QAT) Photo by v2osk on Unsplash When storing…

4 days ago

Breaking the Rules: RPC Pattern with Apache Kafka and Karafka

Introduction Using Kafka for Remote Procedure Calls (RPC) might raise eyebrows among seasoned developers. At…

4 days ago

How to Install PalWorld on Ubuntu VPS (Easy 5 Minute Guide)

This article provides a guide for how to install PalWorld on Ubuntu VPS server. How…

5 days ago

How to Resolve Unmet Dependencies Error on Ubuntu

Using APT to manage software on Ubuntu (or similar Linux systems) is generally simple. It…

7 days ago