How to Change IP Address in Ubuntu: A Comprehensive Guide

How to Change IP Address in Ubuntu


Changing the IP address in Linux is a fundamental skill for system administrators and enthusiasts alike. Whether you’re troubleshooting network issues, setting up a new server, or simply optimizing your network configuration, knowing how to change IP addresses efficiently is essential. In this comprehensive guide, we’ll walk you through the various methods and best practices for changing IP addresses in Linux, empowering you to take control of your network configuration with confidence.

How to Change IP Address in Ubuntu: A Step-by-Step Guide


sudo permissions

Login to Linux Terminal

Use a tool like Putty to log into the Terminal console

Check the Current IP

The system must have a network tools utility installed, if not then run the below command to install

apt install net-tools

run ifconfig -a command

ifconfig -a

For my network, the current adapter is eth0. It could be different for your system

  • Note the current network adapter name
eth0: flags=4163 mtu 1500
inet netmask broadcast
inet6 fe80::215:5dff:fe05:3283 prefixlen 64 scopeid 0x20
ether 00:15:5d:05:32:83 txqueuelen 1000 (Ethernet)
RX packets 5432265 bytes 489778611 (489.7 MB)
RX errors 0 dropped 1454839 overruns 0 frame 0
TX packets 1183678 bytes 4957049089 (4.9 GB)

In the above example, the IP address is and the Subnet mask is

Subnet Calculation

Now, from the above example, the subnet mask is which means it is a 24-bit network so the subnet would be (range

Read more Top Linux Commands for Seamless Operations

Make configuration changes

Netplan tool: Netplan is the default network management tool for the latest Ubuntu versions. Configuration files for Netplan are written using YAML and end with the extension .yaml.

** go to net plan directory
   cd /etc/netplan
** check for the below file
** Edit the file with your favourite editor
   nano 00-installer-config.yaml

The editor will show the configuration below:

In the addresses section change the IP address with the Subnet Suffix

# This is the network config written by 'subiquity'
        search: []
      - to: default
  version: 2

Apply and test the changes

Now, test the configuration to make sure it won’t break anything if test is successful it will ask to apply

sudo netplan try

That’s it on How to Change IP Address in Ubuntu

Scroll to Top