Change IP in Ubuntu Linux: Quick and Easy Methods

Learn how to change IP in Linux Ubuntu effortlessly with our step-by-step guide. Get your network configured in no time!

Updated: 09 Oct, 24 by Susith Nonis 3 Min

List of content you will read in this article:

The Linux operating system has versions available. Ubuntu Linux is one of the most famous and widely used versions of this operating system. If you are using this operating system or want to start it, after installing the operating system, the first and most important thing to do is to configure the IP. Please keep reading to get used to Change IP in Ubuntu Linux.

To configure IP in Ubuntu, first, enter the following path in a command processor:

This tutorial will use the vi command processor to perform the steps.

vi /etc/network/interfaces

Then enter your IP address in the following order:

auto eth0 iface eth0 inet static address 192.168.1.150 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.1.255 gateway 192.168.2.1

Then enter your IP in front of the address option and follow the steps below:

  • In front of the netmask option, enter your subnet address;
  • In the network option, you must enter your network address;
  • In the last two options, you must enter your broadcast and getaway, respectively;
  • In this way, the initial IP configuration in Ubuntu is done successfully.

Once you have done the steps in retrospect, now it's time to set up DNS:

First, follow the following path with the vi editor

vi /etc/resolv.conf

Then enter the list of expressions below the mentioned DNS addresses. You can use the DNS addresses of your choice and enter them instead of the default addresses in this section:

nameserver 8.8.8.8 nameserver 8.8.4.4

Finally, you should save the file and close the page; this way, the DNS setting is done successfully.

⭐⭐Experience unmatched performance, flexibility, and security with our Ubuntu VPS servers. Empower your business with blazing-fast speeds, full root access, and seamless scalability, all backed by the rock-solid stability and open-source power of Linux. ⭐⭐

Linux  VPS
Debian VPS Server

Starting From $5.99/Monthly

In the next step of Changing IP in Ubuntu Linux, you must remove it from your system to prevent the IP from being registered by DHCP. To do so, enter the following address in your editor:

apt-get remove dhcp-client;

This way, DHCP is removed, and your IP remains fixed in the system.

As the last step to configure IP in Ubuntu, you must configure your network card once.

To do this, enter the following statement in the editor:

ifdown eth0 && ifup eth0

After you reset your network card, use the following command to ensure the correct IP configuration:

Ifconfig.

Final tips

After entering this command, you will be shown a page containing general system IP specifications. Dear ones, you can check each set item, and if any of them are incorrect, configure the IP again through the mentioned steps.

Finally, to test, you can ping a website to see if the IP configuration is done correctly or not. To do so, enter the ping command along with the address of your desired site, like ping google.com— if you see a page similar to the one below, the DNS and ip configuration settings are done correctly.

In this article, we tried to teach you how to configure your Linux IP in the best way. By following the mentioned steps, you can complete the IP settings of your system so that you don't face the problem of internet interruption and lack of network connection while using the Ubuntu Linux operating system.

Susith Nonis

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.

user monovm

Prof. Marquis Mante

2025, Jan, 25

This post provides a clear and comprehensive guide on configuring IP settings in Ubuntu Linux, which can be a bit tricky for beginners. The step-by-step instructions make it easy to follow, from setting up initial IP configurations to adjusting DNS settings. A must-read for anyone looking to get the most out of their Ubuntu experience while ensuring a stable and secure network connection. Thanks for sharing such valuable tips!