How to Change IP Address on Ubuntu

12/02/2020

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!

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Ubuntu 18.10 New Features

If you’re a Linux fan then you can consider this article as your complete guide to everything there is regarding Ubuntu...
29/12/2020

How to install the Tweak tool in Ubuntu 20.10?

Tweak tools are used to configure the system and adjust other settings. Various tweak tools make it easy to configure and...
28/12/2020

How to install Zoom in Ubuntu

Online communication is becoming easier day by day. Now, the online users not only can send or receive messages instantly...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024