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” 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:
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:
Step 3: Add DNS IP to static-ip
Then, execute the below-given command for adding the DNS IP to the “static-ip” connection:
Step 4: Activate the Static connection
Make sure that the created “static-ip” connection is active and working on your Ubuntu 22.04:
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:
Lastly, verify the internet connectivity with the help of the following “ping” command:
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.
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.
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.