How to Change the IP Address on Debian 12

The IP (Internet Protocol) addresses are used to identify the devices that are connected to the server or website. It is also used for network routing, internet communication, and for providing network services. 

IP addresses are an important component of Internet communication. Every device contains its own unique IP address. This address helps the devices to connect with the internet servers. 

For security purposes, it is important to change the IP address of the machine. In this blog, different methods of changing the IP address of the machine on Debian 12 have been explored with the following outline:

  1. What is the IP Address
  2. Why Change the IP Address
  3. What are the Methods to Change the IP Address on Debian 12
  4. Method 1: Change IP Address Using the ifconfig Command
  5. Method 2: Change IP Address Using the ip address Command
  6. Method 3: Change IP Address Using the nmtui Tool
  7. Method 4: Change IP Address Using the nmcli
  8. Method 5: Change IP Address Using the GUI Method

Let’s start the article by understanding what is the IP address.

What are the IP Addresses?

The Internet Protocol or the IP address is the assigned label (consists of a number) to every device for connecting and communicating with the Internet. The IP addresses are used to connect the devices to the server. It is also used by the internet servers to identify the location of the computers connected to them. 

There are two types of IP addresses, one is IPv4 and the other is IPv6. The IPv4 is used initially and it is of 32-bit numerical address. When the number of devices increased, then IPv6 was that of a 128-bit numerical address.

It is also important to know that without the IP addresses, it is not possible to connect the printers, computers, and other electronic gadgets with each other or with the server.  

Why Change the IP Address?

As it is explained the IP addresses help to identify the location of the devices, and changing the IP address helps to protect the privacy of the users and their devices. It will secure the geolocation so that online hackers are unable to access the device. 

It also restricts the internet service provider and other websites to track the location of the user and their machine. Moreover, the change of the IP address is also used to test the newly developed websites by the web developers. 

What are the Methods to Change the IP Address on Debian 12?

There are different methods to change the IP address on Debian 12, the most convenient are explained in this blog which are:

  • Using the ifconfig Command
  • Using the ip address Command
  • Using the nmtui Tool
  • Using the nmcli
  • Using the GUI method

Method 1: Change IP Address Using the ifconfig Command

The first method to change the IP address on Debian 12 is by using the ifconfig command. The ifconfig command in Debian 12 is used for the configuration of the networks. Open the terminal and run the below-mentioned command to display the current IP address of the machine:

$ ifconfig

If the “bash: ifconfig: command not found” message is displayed on the screen, then it means the command is not installed on the computer. Install the “net-tools” with the execution of the following command:

$ sudo apt install net-tools -y

Now the “ifconfig” command has been installed, run again to display the current IP address:

$ sudo ifconfig

The IP address of the machine has been highlighted in the figure. The device name is “enp0s3” and to change the IP address, first disable the network:

$ sudo ifconfig enp0s3 down

Then set a new IP address by running the command:

$ sudo ifconfig enp0s3 10.10.10.1

Restart the network by using the ifconfig command:

$ sudo ifconfig enp0s3 up

Display the new set IP address with the command:

$ sudo ifconfig

The IP address has been successfully changed with the ifconfig command. 

Method 2: Change IP Address Using the ip address Command

Another method to change the IP address of the computer is by using the “ip address” command. This command is the advanced form of the net-tools package and comes pre-installed on Debian 12. To display the IP address of the computer with the help of the “ip address”, use the command:

$ ip address

To change the IP address of the computer, run the below-mentioned command with the new IP address:

$ sudo ip address change 10.10.10.1/24 dev enp0s3

To verify the new set IP address, run the command:

$ ip address

The IP address is changed successfully using the ip address command. It is important to tell the users that the “ip address” and “ip addr” are both the same commands. 

Method 3: Change IP Address Using the nmtui Tool

The nmtui is the GUI approach that can be launched using the terminal to set and configure the networks. For instance, to set the IP address, run the command:

$ nmtui

Click on the “Edit a Connection” and then click on the “OK” as shown:

Then choose the network whose IP address is supposed to be changed, then click on the “Edit” button:

Now set the new IP address and scroll down to click on the “OK” button:

The IP address will change successfully using the nmtui tool. 

Method 4: Change IP Address Using the nmcli 

The nmcli is also an approach to manage the networks on Debian 12. To display the network connection of the computer with the nmcli command, run the command:

$ nmcli connection show

To set the new IP address on the computer, run the nmcli command as shown below:

$ sudo nmcli connection modify "Wired connection 1" ipv4.addresses 10.10.10.1/24

The new IP address has been set to Debian 12 successfully using the nmcli command. 

Method 5: Change IP Address Using GUI

The last method to change the IP address on Debian 12 is by using the Graphical User Interface. For this method, click on the “Wired” on the top of the screen and click on the “Wired Settings” as shown:

Then click on the “Gear” icon in the “Wired” section:

Now click on the “IPv4”, then on “Manual”, and change the IP address to the desired. When all is set, then click on “Apply” on the screen:

The IP address has been set successfully. 

All these five methods are explained to change the IP address on the Debian 12 using the terminal or graphical user interface methods. 

Conclusion

To change the IP address on Debian 12, use the ifconfig command, ip address command, nmcli command, nmtui command in the terminal. The IP address can also be set by following the graphical user interface method on Debian 12. All these methods to change the IP address on Debian 12 have been explained in this blog with a detailed guide. It is recommended to change the IP address of the computer to protect the devices from online hackers.