Set Static IP Address in Ubuntu 22.04 Example

10-Feb-2023

.

Admin

Set Static IP Address in Ubuntu 22.04 Example

Hi Guys,

This tutorial will provide example of Ubuntu 22.04 on Set Static IP Address. it's simple example of How to Set Static IP Address on Command Line. Here you will learn Step by Step Set Static IP Address in Ubuntu 22.04. you will learn Command Line on Set Static IP Address in Ubuntu 22.04. follow bellow step for Linux Basics - Set a Static IP on Ubuntu.

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