Setup Static IP Ubuntu 22.04 2

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 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.

Setup Static IP Ubuntu 22.04 3

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.

Setup Static IP Ubuntu 22.04 4

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.

Setup Static IP Ubuntu 22.04 5

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.

Setup Static IP Ubuntu 22.04 6

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.

Setup Static IP Ubuntu 22.04 7

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.

Setup Static IP Ubuntu 22.04 8

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.

Setup Static IP Ubuntu 22.04 9

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.

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”.

Setup Static IP Ubuntu 22.04 10

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.

Setup Static IP Ubuntu 22.04 11

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.

Setup Static IP Ubuntu 22.04 12

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

Setup Static IP Ubuntu 22.04 13

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.

Setup Static IP Ubuntu 22.04 14

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.

Setup Static IP Ubuntu 22.04 15

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.

Setup Static IP Ubuntu 22.04 16

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.

Leave a Comment

Your email address will not be published. Required fields are marked *