TL;DR
To change ip address in Linux, you can try these three methods:
- Using the
ifconfigCommand: Change IP address through the command line. - Configuring IP Address via Network Manager: Change IP address using a graphical interface.
- Using the
ipCommand: Change IP address with extensive network configuration capabilities.
Changing IP addresses in Linux requires careful attention to ensure a smooth transition. Follow best practices such as obtaining proper authorization, planning and documenting changes, verifying compatibility, and conducting thorough testing. By adhering to these practices, you can minimize disruptions, maintain system security, and seamlessly transition to the new IP address configuration.
Explore the guide below to learn different methods and best practices to change ip address in Linux.
IP addresses are unique identifiers assigned to devices connected to a network, enabling data transfer and communication. You might need to change IP address in Linux for various reasons, such as safeguarding your privacy, accessing geo-restricted content, troubleshooting network issues, or even experimenting with different network configurations.
In this ultimate guide, I will explore three effective methods to change IP address in Linux and four best practices to remember when changing the ip address.
How to Change IP Address in Linux
To change IP address in Linux, you have options that suit your preferences. For advanced users and scripting, the ifconfig command provides command-line control. Network Manager offers a user-friendly graphical interface, while the ip command provides extensive network configuration capabilities.
1. Using the ifconfig Command
This method allows you to change your IP address through the command line, making it useful for advanced users and scripting purposes. Follow these steps to change your IP address using ifconfig:
- Open a Terminal window.

- Identify the network interface you want to modify by running the command:
<strong>ifconfig -a</strong> - It will display a list of available network interfaces.

- Disable the network interface using:
<strong>sudo ifconfig interface down</strong> - Replace the interface with the interface that you selected.

- Change the IP address using the command:
<strong>sudo ifconfig interface new_ip_address netmask subnet_mask up</strong> - This command will change the IP address.

- Verify the changes by running
ifconfigagain.

2. Configuring IP Address via Network Manager
Network Manager provides a user-friendly graphical interface for changing IP addresses, making it suitable for users who prefer a visual approach to network configuration. Here’s how you can change IP address in Linux using Network Manager’s graphical interface:
- Open the Network Manager applet from the system tray or access it through the system settings.

- Locate the network connection you want to modify and select it.

- Click on the IPv4 or IPv6 tab, depending on the type of address you wish to change.

- Choose the Manual option from the Method dropdown menu.

- Enter the desired IP address, subnet mask, gateway, and DNS servers, then click on the apply button.

- The output will be:

3. Using the ip Command
The ip command offers extensive network configuration capabilities, making it a powerful tool for advanced users who require fine-grained control over IP address changes. Follow these steps to change your IP address using the ip command:
- Open a Terminal window and identify the network interface you wish to modify using the command:
<strong>ip addr show</strong> - The command will show a list of network interfaces.

- Disable the network interface:
<strong>sudo ip link set interface down</strong> Replace interface with interface name that you chose.

- Change the IP address by executing the command:
<strong>sudo ip addr add new_ip_address/subnet_mask dev interface</strong> - The command will change the ip address.

- Enable the network interface: