Categories: TutorialsUbuntu

Setup Static IP Ubuntu 22.04

We received the IP address in our devices from Dynamic Host Configuration Protocol (DHCP). A DHCP server assigns the device a temporary IP address once it is joined to the network. Therefore, we have the opportunity to occasionally modify the specified IP address with the static IP address. Static IP is very much different from dynamic IPs. Static IPs are fixed and unchangeable addresses. When the device is connected to the internet, the static IP provides us with a consistent identity and location.

The network providers give the same IP addresses to the two separate users because there are not enough IP addresses available. Due to this, the users encounter connection issues. Alternatively, static IP addresses minimize these conflicts because they are user specific. Here, we will set up the static IP address for the Ubuntu 22.04 LTS using two different procedures. We have simple steps to configure static IP in Ubuntu 22.04.

Set
Sponsored
up static IP graphically in Ubuntu 22.04:

We have demonstrated the steps to set up an IP address in Ubuntu 22.04 with its desktop environment as the user prefers activities graphically rather than the terminal command. To establish a static IP address in the GUI Network Settings of Ubuntu 22.04, follow the instructions below. We can go to the settings from the activities of Ubuntu and then click on the “network”. We can also click the network icon from the top of the Ubuntu 22.04 screen.

The network icon here shows many features which we can set. But our concern is with the “wired connected” section. Wired connected provides two more features: one for turning on/off wifi connection and the other one is setting the wired network. By clicking on the “wired setting”, the network setting page will be opened.

Now, we are in the settings of Ubuntu 22.04 “Network”. From here, we have to press the “gearbox” icon located at the bottom of the “wired” section.

Once the setting icon is clicked, a dialog box will be generated which provides further information about the network IP. On the dialog box, we have an option “IPv4” or “IPv6”. We can switch to any of these options. Here, we have selected the IPv4 option.

The “IPv4” is set with the automatic (DHCP) which means that the DHCP server provides the IP address here automatically. But for the manual configuration of IP address, we have to select the option “manual”. We have options here to set up the static IP address for our Ubuntu 22.04 system. We have to provide the values against “Address”, “Netmask”, “Gateway” and the “DNS”. Make sure to provide valid values against each portion. Then, to save the settings, click the “Apply” option.

To execute the actions above, we should have to restart the network interface by turning it off and then on the toggling icon in the wired section.

We can verify the static IP address which we have set manually by again clicking the gear icon that lies under the wired section. The values we have assigned for the IP address have been changed as shown in the dialog box below. As a result, we were able to use the GUI to set up the static IP address on our Ubuntu 22.04 server.

Set up static IP with nmcli command in Ubuntu 22.04:

We have seen the configuration of the static IP address with the desktop environment of Ubuntu 22.04 above. We can also configure the IP address through the commands in the Ubuntu 22.04 terminal. For setting the static IP address via terminal, we used the “nmcli” command. Linux allows users to manage the “Network Manager” by executing the “nmcli” command. We have used this command to create, edit, delete, activate, or deactivate network connections as well as output the information of specific network status. Here, the text-based interface nmcli is used to monitor the status of the Ubuntu 22.04 wired connections. With this command, we can access the advanced information of our device network.

Sponsored

First, we launched the terminal and entered the “nmcli connection show” command to get the name of the device. Here, we have a device named “enp0s3”.

Then, we entered the nmcli command for the existing connection we have in our Ubuntu 22.04. The connection detail is displayed when the command is executed.

With the sudo privilege, we have set the static IP address with the nmcli command. We have changed the wired connection name and also set the IPv4 address. The administrator permission is required to run the following command as shown in the Ubuntu 22.04 prompt screen.

The next nmcli command we have entered is for the DNS IP address for the static IP connection.

The configuration of the static IP connection is done. Now, we have given the two commands simultaneously. The command is for deactivation and activation of the wired connection. We have deactivated and also activated the connection here.

With the “ip add show” command, we have verified the connection’s static IP address. The information of our static IP is displayed after we run the command.

We can also view the routing table of Ubuntu 22.04 by following the “ip route show” command. The route table specifies the subnet and network traffic of our system. The current route table of Ubuntu 22.04 is below. By doing this, we may establish Ubuntu 22.04’s static IP.

Conclusion

We have carried out the procedures of setting the static IP in our Ubuntu 22.04 using both the command line and a graphical user interface (GUI). It’s all up to our preference whether to follow the steps of the GUI or the command line. From the GUI network setting of the current wired connection, we have configured the static IP. Then, we utilized the nmcli command for setting the static IP in Ubuntu 22.04. The most important thing is that we can revert the changes of the configuration of static IP to return to DHCP whenever we are required.

Ubuntu Server Admin

Recent Posts

A CISO’s preview of open source and cybersecurity trends in 2026 and beyond

Open source has come a long way. Recently I was watching a keynote address by…

5 days ago

Canonical Kubernetes officially included in Sylva 1.5

Sylva 1.5 becomes the first release to include Kubernetes 1.32, bringing the latest open source…

5 days ago

Canonical expands total coverage for Ubuntu LTS releases to 15 years with Legacy add-on

Expansion ensures business continuity without forcing major upgrades Today, Canonical announced the expansion of the…

6 days ago

Announcing YARD-Lint: Keep Your Ruby Documentation Solid

TL;DR: YARD-Lint catches documentation issues, just like RuboCop for code. Star it and use it…

6 days ago

Canonical releases FIPS-enabled Kubernetes

Deploy a FedRAMP-ready kubernetes cluster and application suite, with FIPS 140-3 crypto and DISA-STIG hardening…

1 week ago

Canonical announces optimized Ubuntu images for Google Cloud’s Axion N4A Virtual Machines

This new release brings the stability and security of Ubuntu to Axion-based N4A virtual machines…

1 week ago