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!

Motoare de jocuri gratuite și open source pentru dezvoltarea jocurilor Linux
Acest articol va acoperi o listă de motoare de jocuri gratuite și open source care pot fi utilizate pentru dezvoltarea jocurilor 2D și 3D pe Linux. Ex...
Tutorial Shadow of the Tomb Raider pentru Linux
Shadow of the Tomb Raider este a douăsprezecea completare a seriei Tomb Raider - o franciză de jocuri de acțiune-aventură creată de Eidos Montreal. Jo...
Cum se mărește FPS în Linux?
FPS înseamnă Cadre pe secundă. Sarcina FPS este de a măsura rata de cadre în redările video sau în performanțele jocului. În cuvinte simple, numărul d...