Ubuntu

How to Change IP Address on Ubuntu

How to Change IP Address on Ubuntu

In this post we will try to change the IP address of a Ubuntu based Linux system from the command line. Though we will be using Ubuntu 16.04 but the steps should work for any version of Ubuntu.

Listing Network Interfaces

We will start by listing all network interfaces for your system. We are doing this so that we know the name of the network for which we want to modify the IP address. Now, go on and run the following command:

ifconfig

Once we run this command, we will see something like:

So, we have two networks mentioned here with much more metadata. To change settings of a network, we will make use of the same command with few more parameters.

Additional parameters with ifconfig

Let's write a command using ifconfig which will change the IP address of the network 'enp0s3' to 192.168.0.1 and also changes the subnet mask 255.255.255.0:

sudo ifconfig enp0s3 192.168.0.1 netmask 255.255.255.0

When we run this, we don't get anything back:

This time, when we again run the ifconfig command, we will see that IP address have changed:

Changing the Default Gateway

We can also modify a network's gateway with simple command as:

Of course, no output is returned. But we can check the settings with this command:

route -n

Let's run this now:

That's all. It was super easy to change your IP from the command line. Do check out other linux based lessons as well!

Open Source Ports of Commercial Game Engines
Free, open source and cross-platform game engine recreations can be used to play old as well as some of the fairly recent game titles. This article wi...
Parhaat komentorivipelit Linuxille
Komentorivi ei ole vain suurin liittolainen Linuxia käytettäessä - se voi olla myös viihteen lähde, koska voit käyttää sitä pelaamaan monia hauskoja p...
Parhaat Linux-peliohjaimen kartoitussovellukset
Jos haluat pelata pelejä Linuxissa peliohjaimella tyypillisen näppäimistön ja hiiren syöttöjärjestelmän sijaan, on sinulle hyödyllisiä sovelluksia. Mo...