In this tutorial, i am going to show you how to set static ip address on linux ubuntu 22.04 system using command line or prompt.
Set Static IP Address on Ubuntu 22.04 Command Line
Follow 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 of all open terminal or command line to check device name by using the following command:
nmcli connection show
The given output shows that our device name is “emp0s3”:
Step 2 – Create a Static connection
Use the following command to create a new static connection named “static ip” for the “emp0s3” device:
$ 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
Run 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
Run 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
Now, run the “ip” command with the “a” option to validate the IP assigned to the “enp0s3” device:
ip a
Then, verify the internet connectivity with the help of the following “ping” command:
ping google.com
Conclusion
Through this tutorial, i have shown to you how to set a static IP address on Linux ubuntu 22.04 system using the command line or prompt.
Be First to Comment