How to Set Static IP Address on Ubuntu 22.04

Hello folks, in this guide, we will cover how to set static ip address on Ubuntu 22.04 (Jammy Jellyfish) step by step.

There are two ways to configure static ip address on Ubuntu 22.04,

  1. Command line
  2. GUI (Desktop Environment)

From command line we use either nmcli or netplan command to set static ip address.

Set Static IP address using nmcli command

Open the terminal, run following nmcli commands.

To view the existing connection, run

$ nmcli connection show
$ nmcli


As we can see above, my system has an existing connection named ‘Wired connection 1’ which is using physical nic ‘enp0s3’. In my case, this interface is getting IP address from DHCP server. So, to set the fixed static ip run,

Note: Replace the IP address and connection name as per your environment.

$ sudo nmcli con modify 'Wired connection 1' ifname enp0s3 ipv4.method manual ipv4.addresses gw4

Add the DNS IP address,

$ sudo nmcli con mod 'Wired connection 1' ipv4.dns

Disable & enable the connection, run

$ sudo nmcli con down 'Wired connection 1' && sudo nmcli con up 'Wired connection 1'

Output of above commands would look like below:


Now this ip address is persistent across the reboot. To verify ip address run following ip commands,

$ ip add show
$ ip route show


Alternate way to configure static ip address is via netplan utility.

Create ‘01-netcfg.yaml‘ under the directory /etc/netplan with following content,

$ sudo vi /etc/netplan/01-netcfg.yaml
  version: 2
  renderer: networkd
    enp0s3: #Change the interface name as per setup
      dhcp4: no
        - to: default
          metric: 100


Save and close the file.

To make the above changes into the affect, run

$ sudo netplan apply

View the IP address, run

# ip address show


Perfect, above confirms that static ip address has been assigned to enp0s3 interface.

Setup Static IP address via GUI (Desktop Environment)

If you are not comfortable with command line, then you can set static ip address from desktop GUI.

From the Desktop Activity –>Search Settings –> Go to Network section


Click on the gearbox icon then following window will be shown. Select IPv4 Tab,


Change the IPv4 Method from Automatic to Manual. Specify the IP address details along with DNS IP.


Click on Apply to save the changes.

Now disable and enable the interface by toggling the icon.


Close the settings window and verify the ip address using following commands


That’s all from this guide, I hope you have found it informative. Kindly do post your feedback and queries in below comments section.

Read Also: How to Install Docker on Ubuntu 22.04 / 20.04 (Step by Step)

2 thoughts on “How to Set Static IP Address on Ubuntu 22.04”

Leave a Comment

two × five =