An IP address is a sequence of numbers that is assigned to a device when it is connected to the network. It is a unique address, and there are two types of IP addresses, ipv4 and ipv6. Most of the time a DHCP server assigns a default IP address to every device whenever the device is connected to the network. However, we can change the IP addresses of our machines manually. Ubuntu 22.04 is the latest Linux distribution and comes with many networking tools. These tools help us with the configuration process of the network. We can use these tools for configuring our network settings.
In the following article, we will learn about how we can change the IP address of our Ubuntu 22.04 system.
How to Change IP address in Ubuntu 22.04?
The need for changing IP addresses can be a security concern. The default IP addresses are predefined and known by the intruders. The default IP address can be a security vulnerability. It means that we should change our IP addresses so that we can protect our systems from security vulnerabilities. If you want to change the IP address of your machine, there are two possibilities for this task:
- Using Terminal
- Using GUI
You can use both methods for performing this task.
Method 1: Using Terminal
In this method, we will use the terminal, press “Ctrl + Alt + t” and launch the terminal. Firstly check your default IP address by using the following command:
$ ip addr
The command will display the IP address of your LAN card. In my case, it is 10.0.2.15/24:
Now, install the following package for the network utilities, by typing the following command in the terminal:
$ sudo apt install net-tools
The command will install the network tools package:
Now, to check the details of the network, type the following command:
$ ifconfig
The command will show the network details as follows:
Type the “sudo ifconfig <your lan card no> <your ip> netmask <specify netmask>” command in the terminal to change your default IP address:
$ sudo ifconfig <you lan card no> <ip address> netmask <your netmask"
The command will change the IP address to your specified IP:
To verify the changes, use the “ifconfig” command again:
$ ifconfig
You can see that the changes have been made and your IP address has changed:
We will also verify whether the IP address we have specified is working or not. For this purpose use the following command:
$ ping <your ip>
The command will display the incoming and outgoing packets as follows:
Press “Ctrl + c” to exit from the ping command.
Now let’s take a look at the second method, by using the GUI, how you can change the IP address.
Method 2: Using GUI
Over time, Linux distributions have made significant changes in the GUI for the convenience of layman users, especially Ubuntu has improved GUI very effectively. In the following method, we’ll learn about how we can change the IP address using GUI. For this purpose, click on the upper right corner of your Desktop window and click on settings:
The settings window will appear. Select Network, Click on the gear icon, and it will display the network settings:
From the top bar menu, select IPv4, and select the Manual radio button, from the IPv4 Method:
After enabling, Manual settings, specify the Address, Netmask, and Gateway in the corresponding text boxes:
All done, you have specified all the changes, and now you can click on Apply, to save the changes:
To verify the changes, go to the details window, and you’ll that the IP address has been changed:
This is how you can change your default IP address in Ubuntu 22.04.
Conclusion
To change the IP address in Ubuntu 22.04, you can use your terminal as well as you can change it by using the GUI settings option. In this article, we have explained how we can change the IP address.