If you’re using Ubuntu Linux, there are three different ways that you can change your IP address.
Which method you use will depend on whether you want to change your address permanently or just temporarily.
In either case, I’ll walk you through the steps so that you can get started right away.
change ip address in Ubuntu Linux with ip addr command
The first method is to use the “ip addr” command in a terminal window. This will allow you to easily change your IP address with just one command. To do this, open up a terminal and type the following:
sudo ip addr add 192.168.1.100/24 dev eth0
This will add another IP address 192.168.1.100 with a subnet mask of 255.255.255.0, assuming that eth0 is the network interface you want to change the address on.
Note: You should replace eth0 with the name of your network interface if it is different, such as wlan0 for a wireless connection.
The disadvantage of using this command is that the changes are not permanent. If you restart your computer or networking service, the IP address will be reset to its original setting.
However, if you need to change the IP address quickly and don’t want to reboot or restart services, then this is a good option.
Another thing we need to pay attention to is that we need to delete the old ip address manually.
To delete an IP address manually, you’ll need to use the “ip addr del” command. This will allow you to delete a specific IP address from your network interface.
For example, if I need to delete 192.168.1.101 from eth0, then I will type the following into a terminal:
sudo ip addr del 192.168.1.101/24 dev eth0
change ip address in Ubuntu Linux with network-manager
The second way to change your IP address on Ubuntu is to use the Network Manager. This is a graphical tool that allows you to easily configure your network settings, including changing your IP address. To do this, open up the Network Manager by clicking on the icon in your taskbar or searching for it in Dash.
Once you’re in the Network Manager, select your network connection and click “Edit”. You should then see an option to change your IP address. Enter the new one and click “Apply” to save the changes.
change ip address in Ubuntu Linux with netplan
The last method to change your IP address in Ubuntu is to use the Netplan tool. This is a new network configuration tool that was introduced in Ubuntu 17.10 and is available for all newer versions of the operating system.
To use Netplan to change your IP address, you’ll need to create a configuration file in the /etc/netplan directory. This file should have the .yaml extension.
For example, if I want to call it mynetwork.yaml, then I will type the following into the terminal: sudo nano /etc/netplan/mynetwork.yaml
Once I have the configuration file open, I’ll need to set the IP address for my network interface. This should look something like this:
addresses: [192.168.100.1, 192.168.100.2]
Make sure to replace enp0s3 with the name of your network interface and enter the IP address you want to use instead of 192.168.100.50.
Once it is done, save the configuration file and then type the following into a terminal to apply the changes:
sudo netplan apply
This will change your IP address to the one we specified in the configuration file immediately. The advantage of using this method is that the changes are permanent and will persist across reboots or service restarts.
You should then see the new address listed when you type:
Your IP address can be changed with either of these three methods! Remember that if you’re using the ip addr, the changes are not permanent and will be lost when you restart or reboot your system.
If you want to make the changes permanent, then you’ll need to use the netplan command.
Once you’ve changed your IP address, it’s important to test that everything is working as expected. You can do this by pinging another device on your network or attempting to connect to the Internet. You should also check that other devices on your network are able to access your computer.
If everything is working correctly, then you have successfully changed your IP address in Ubuntu! Congratulations!