Ubuntu 22.04 Set Static IP Address Command Line

Ubuntu set static ip address using command line; Through this tutorial, we will learn how to set static ip address on linux ubuntu 22.04 system using command line or prompt.

How to Set Static IP Address in Ubuntu 22.04 Using Command Line

Steps to set static ip address in ubunut 22.04 using command line or terminal:

  • 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

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

Now, execute 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, we have learned how to set a static IP address on Linux ubuntu 22.04 system using the command line or prompt.

Recommended Linux Ubuntu Tutorials

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *