Ubuntu, being a predominantly Linux operating system, has several programs to assist us in completing various tasks. It’s crucial to understand how to update your computer’s IP address since it allows you to transport any sort of data over a network. In this post, we’ll go through the two distinct methods for changing IP addresses on your Ubuntu system.
An IP address, or Internet Protocol address, is a numeric address assigned to various computers and networked devices that use the Internet Protocol. An IP address is used to both identify and determine the location of a machine. Every IP address on the network is unique, allowing for better communication between all connected devices. There are two sorts of IP addresses: public and private (public and private). Your public IP-address is used to communicate via the Internet in the same manner that your physical address is used for postal mail. In the other hand, every device on a local network is given a private IP address that is unique within its sub-network.
Another distinction between IPv4 and IPv6 protocols may be made. IPv4 is the most used IP format, consisting of a four-part structure with four bytes separated by dots (e.g., 192.168.1.3). Apart from the fact that as the number of devices increases, it becomes increasingly difficult to keep track of them all, IPv4 may soon run out of addresses. That is why, in contrast to IPv4, IPv6 was invented.
There are two ways through which your IP address can be changed in Ubuntu:
A brief detail of both methods is explained below:
The Command-Line method is a simple and mostly used way in Linux to change your IP address in Ubuntu. First, run the mentioned below command to check active network interfaces:
$ ip link |
After listing network interfaces, open the file named as “/etc/netplan/*.yaml” in nano editor by using the command mentioned below:
$ sudo nano /etc/netplan/*.yaml |
“/etc/netplan/*.yaml” file will open a new page having following information:
In the “/etc/netplan/*.yaml” file write the mentioned below code in order to change the IP address:
network: version: 2 renderer: networkd ethernets: enp0s3: dhcp4: no dhcp6: no addresses: [192.168.2.2/24] gateway4: 192.168.2.2 nameservers: addresses: [8.8.4.4, 8.8.8.8] |
After writing the code, press “CTRL+O” to save the changes, and to apply the settings run the mentioned below command:
$ sudo netplan apply |
Now, run the mentioned below command to check the modified IP address of the “enpos3”
$ ip a |
By running this command, you can get a modified IP address of any network interface on your Ubuntu system.
If you don’t know how to use the command line or you are facing any difficulty in the application of commands, you can also check IP addresses by another method.
Mentioned below are the steps to change IP-address using GUI.
Open the Ubuntu Applications Menu which is provided in the left corner of the screen (denoted by the nine dots symbol) and then search for “Settings” option and click on the icon:
Settings Menu will be shown after clicking the “settings” icon. In settings options, go to “Network”.
When you press the “gear icon” given after your connection, a window will get opened that contain more setting and information of your connection with network and IP-address. In order to change IPv4 address, click on the “IPv4” tab.
After selecting the IPv4 tab, select the method as “manual” enter details of your own choice and then click on the “apply” button.
After clicking on the “apply” button, in order to apply new IP settings, turn the switch OFF and ON.
In order to check whether new settings are applied or not, click on the “gear icon” and then go to the “details” option provided in the network settings icon and new IPv4 address settings will be obtained.
In this article, the basic overview of IP addresses, their types, and the contrast between the IPv4 and IPv6 protocols is being provided. The two different ways through which you can change your IP address in Ubuntu Linux are being discussed in this article as well. These approaches include the command line approach and the GUI approach.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.
At Canonical, the work of our teams is strongly embedded in the open source principles…
Welcome to the Ubuntu Weekly Newsletter, Issue 873 for the week of December 29, 2024…
Have WiFi troubles on your Ubuntu 24.04 system? Don’t worry, you’re not alone. WiFi problems…
The following is a post from Mark Shuttleworth on the Ubuntu Discourse instance. For more…
I don’t like my prompt, i want to change it. it has my username and…
Introduction: A Fragile Trust The Ruby ecosystem relies heavily on RubyGems.org as the central platform…