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

The future of Kubernetes networking: Cilium and other CNIs with Canonical Kubernetes

Choosing the right Container Network Interface (CNI) for Kubernetes is critical to achieving optimal performance,…

4 days ago

How does MongoDB work?

What is MongoDB? Data is essential for gaining a competitive advantage in business. It has…

4 days ago

Mastering LVM Management on Ubuntu VPS: An Introductory Guide

This article provides an introductory guide to mastering LVM management on Ubuntu VPS servers. Mastering…

5 days ago

Welcome to the Ubuntu Weekly Newsletter, Issue 885

Welcome to the Ubuntu Weekly Newsletter, Issue 885 for the week of March 23 –…

5 days ago

Securing Software Supply Chains: New Research Highlights Industry Vulnerabilities

New IDC study, co-sponsored by Canonical and Google Cloud, reveals the challenges and opportunities for…

6 days ago

Automated patching for the Linux kernel

To start securely and efficiently, Linux systems follow a carefully orchestrated sequence of steps to…

6 days ago