How to Configure Static IP Address on Ubuntu 22.04?

Jul 07, 2022 . Admin

Hi Guys,

In this post, we will learn Set Static IP Address on Command Line in Ubuntu 22.04. In this article, we will implement a Steps to Set Static IP Address on Ubuntu 20.04. This article goes in detailed on Set a Static IP Address On Ubuntu 22.04. We will look at example of Ubuntu 22.04 use Command Line on Set Static IP Address.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

Use the following steps to set static ip address using command line; is as follows:

Step 1 – Check device name

Step 2 – Create a Static connection

Step 3 – Add DNS IP to static-ip

Step 4 – Activate the Static connection

Step 5 – Verify the IP assignment to the selected device

Step 1: Check device name

First open a terminal or command line using the following command:

nmcli connection show
Step 2: Create a Static connection

Use the following command to create a new static connection named "static ip":

$ sudo nmcli con add type ethernet con-name 'static-ip' ifname emp0s3 ipv4.method manual ipv4.addresses 192.168.1.102/24 gw4 192.168.1.1
Step 3: Add DNS IP to static-ip

Execute the following command to add the DNS IP to the “static-ip” connection:

sudo nmcli con mod static-ip ipv4.dns 192.168.1.1
Step 4: Activate the Static connection

Execute the following command on command lien to active “static-ip” connection:

sudo nmcli con up id 'static-ip'
Step 5: Verify the IP assignment to the selected device

Run the "ip" command with the "a" option to validate the assigned IP:

ip a

Check Internet connectivity using the following command:

ping google.com
#Ubuntu