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!

How to change Left & Right mouse buttons on Windows 10 PC
It's quite a norm that all computer mouse devices are ergonomically designed for right-handed users. But there are mouse devices available which are s...
Emulate Mouse clicks by hovering using Clickless Mouse in Windows 10
Using a mouse or keyboard in the wrong posture of excessive usage can result in a lot of health issues, including strain, carpal tunnel syndrome, and ...
Add Mouse gestures to Windows 10 using these free tools
In recent years computers and operating systems have greatly evolved. There was a time when users had to use commands to navigate through file manager...