How to configure static IP address on Ubuntu 22.04 LTS and 22.10

On the other hand, static IP refers to a fixed address, which cannot be changed, which is different from dynamic IP. You can set static IP settings for Ubuntu 22.04 LTS and 22.10 versions in 3 different ways.

Set static IP on Ubuntu using nmcli command

It's pretty easy to configure Ubuntu 22.04 static IP settings using the nmcli command. nmcli is a text-based utility used to check the status of the wired connections you are using on your device.

With this command, you can access additional network information such as connection status, host device name, and general permissions in the network configuration. Also, this command is useful in Ubuntu server static IP settings.

You can get information about your connection with the following command:

nmcli connection show

The output of this command will be as follows:

NAME UUID TYPE DEVICE Wired connection 1 12f312a7-f0e7-334a-8ab4-c7b3f8249c7e ethernet enp0s3 

Create a static link with the command below. Then configure the enp0s3 and ipv4 settings manually with the appropriate parameters in the nmcli command:

sudo nmcli con add type ethernet con-name 'static' ifname enp0s3 ipv4.method manual ipv4.addresses 192.168.1.89/24 gw4 192.168.1.1

If you use the nmcli connection show command again, you can see that the static link has been added.

How to configure static IP address on Ubuntu 22.04 LTS and 22.10 Picture 1

After this process, add the static connection you created to the DNS IP:

sudo nmcli con mod static ipv4.dns 192.168.*.*

Now use the command below to enable the connection:

sudo nmcli con up id 'static'

If the output shows "connection enabled successfully" then you have successfully set up a static IP address on your machine.

You might consider using a static IP address to avoid connection problems caused by dynamic IP addresses. A static IP address allows you to have a fixed identity and location when connected to the Internet.

You can verify the static IP you want to assign to your device by running the following command:

ip route

How to configure static IP address on Ubuntu 22.04 LTS and 22.10 Picture 2

Using Netplan to Install Static IP on Ubuntu

Just like nmcli, another command that you can use to set a static IP on Ubuntu is netplan. You can easily do a static IP setup for Ubuntu using the netplan command in versions 22.04 LTS and 22.10. To do this, follow the steps below.

First find your network interface name with the command below:

sudo ip a

How to configure static IP address on Ubuntu 22.04 LTS and 22.10 Picture 3

What you see here is your network interface name. This name may be different on each device.

Now, create a file named 01-netcfg.yaml in the directory /etc/netplan. Edit it with your favorite text editor.

sudo vim /etc/netplan/01-netcfg.yaml

Add the following lines to the file:

network:   version: 2   renderer: networkd   ethernets:     eth0: #Edit this line according to your network interface name.       dhcp4: no       addresses:         - 192.168.1.10/24       gateway4: 192.168.1.1       nameservers:         addresses:           - 8.8.8.8           - 8.8.4.4

As can be seen, you have disabled the DHCP IP setting with the dhcp4: no command . Then you added the IP address and DNS settings specified by Google.

After saving this file, run the following command to apply the changes:

sudo netplan apply

Configure Static IP Settings on Ubuntu Using the GUI

The graphical interface in Ubuntu 22.04 is quite useful if you don't want to use the command line. So much so that you can easily set Ubuntu's static IP address using this interface.

To do this, click the Network icon in the upper right corner of the screen. Then, select Wired Settings from the drop-down menu. Click the gear icon to open the settings window.

How to configure static IP address on Ubuntu 22.04 LTS and 22.10 Picture 4

Then switch to the IPv4 tab in the window that opens.

How to configure static IP address on Ubuntu 22.04 LTS and 22.10 Picture 5

As you can see, DHCP is enabled by default. Change IPv4 Method to Manual when you want to use static IP instead of dynamic IP. Next, change the address, netmask and gateway settings. Finally, modify the DNS settings and click the Apply button.

How to configure static IP address on Ubuntu 22.04 LTS and 22.10 Picture 6

You must restart the wired connection for all these actions to take effect. To do this, simply toggle the switch next to the network name on and then off.

How to configure static IP address on Ubuntu 22.04 LTS and 22.10 Picture 7

5 ★ | 1 Vote

May be interested

  • What is static IP? What is dynamic IP? Distinguish between static IP and dynamic IPWhat is static IP? What is dynamic IP? Distinguish between static IP and dynamic IP
    if you use the internet frequently or access the internet repeatedly, the term 'ip address' has certainly been heard at least once. but what is an ip address? what does it mean ? what information does it show? how many types of ip address are there? through the essay
  • How to assign a static IP address in Windows 11, 10, 8, 7, XP or VistaHow to assign a static IP address in Windows 11, 10, 8, 7, XP or Vista
    sometimes, it's better to assign an ip address to a computer so that the router automatically assigns the ip address. let's read this article to know how to assign static ip addresses in windows.
  • Display IP address on the system tray on UbuntuDisplay IP address on the system tray on Ubuntu
    in some cases, troubleshooting a problem requires a computer ip address to check the system ip address. if you are using ubuntu and want to find the available ip address on your computer, you can display ip address in the system tray.
  • How to set a static IP address for a Windows 11 computerHow to set a static IP address for a Windows 11 computer
    step-by-step instructions to set up a static ip address on windows 11. 2 ways to change the static ip address on a windows 11 computer
  • How to set up static IPs for computersHow to set up static IPs for computers
    usually your computer to dynamic ip address, but in some cases you need to set a static ip for the machine. the following article details how to set up static ip for computers on windows 7 and 8 operating systems.
  • How to set a static IP on Windows 11 simplyHow to set a static IP on Windows 11 simply
    do you want to change the static ip address on windows 11, set a static ip for your win 11 to share the folder with other lan users, or avoid the same ip that you can't access the network but don't know how? let's join taimienphi to set a static ip on windows 11 through the following article.
  • Configure IP network address with MS-DOS commandConfigure IP network address with MS-DOS command
    usually to configure and set the ip address for machines in the network you just need to configure in network connections and set the ip address in the tcp / ip protocol with the windows interface. now we introduce a method to configure the ip address using the command line command sometimes this way will be used in necessary cases.
  • Instructions for setting static IP addresses, changing DNSInstructions for setting static IP addresses, changing DNS
    set static ip addresses for each computer on the same local network to avoid address conflicts between computers. also can change the dns address to access the web with fast speed and to some blocked websites such as facebook ...
  • Set up Windows Server 2016 with a static IP addressSet up Windows Server 2016 with a static IP address
    if you are setting up windows server 2016 as a domain controller or doing any other production server functionality on the network, you should set it up with a static ip address.
  • What is an IP address?What is an IP address?
    ip address (internet protocol ip) is the number of formats for a network hardware, devices that use ip addresses to communicate with each other over an ip-based network like the internet.