Debian

How to Get an IP Address on Debian 12

How to Get IP Address on Debian 12

Internet Protocol generally known as IP is a unique code assigned to a device connected to the Internet. All the running applications and services over the internet on Debian 12 use this IP address to route the data to and from the internet. Knowing your system’s IP address is important because it’s required when troubleshooting network-related issues. The IP address is also required while accessing another system.

The IP address is divided into two basic categories: Public and Private; the private IP address is the one that is assigned by the network router to each device and the public IP address is assigned by your ISP provider that acts as your network identification on the internet. The private IP address only works within your local network while a public IP address can be used to access the online resources.

In this guide, you will learn:

 

How to Get an IP Address on Debian 12

The following are the two ways to get an IP address on Debian 12:

 

Method 1: How to Get an IP Address on Debian 12 Through GUI

You can get an IP address on Debian 12 through GUI using the below steps:

Step 1: First, click on the cog icon from the top right corner and then expand the Wired option:

Step 2: Next, click on the Wired Settings:

Step 3: The Network settings will appear on your screen, click on the gear icon present in front of the connected network, also highlighted in the below image:

Step 4: The prompt will appear, with the information of the connected network. It also contains the IP address of your Debian 12 system:

 

Method 2: How to Get an IP Address on Debian 12 Through the Command Line

The following commands are used to find the IP address on Debian 12:

 

1: How to Get an IP Address on Debian 12 Using ip Command

The ip command is mostly used commands on Linux systems for configuring network interfaces. Using the following command, you can display all devices and get the IP address of the connected device on your Debian 12:

ip addr

Note: If your device is connected with Wi-Fi, the IP address will appear in wlan0.

Another ip command that shows the IP address of the network on Debian is written below:

ip addr show

You can also find the IP address of a specific interface using the following syntax:

ip addr show dev [interface]

In my case, I am finding the IP address of enp0s3 on my Debian 12:

ip addr show dev enp0s3

Note: The digits after the slash i.e. /24 and /64 represent the network size.

The below command provides comprehensive details about the interfaces including the IP address:

ip a

The ip command can be used with the r option to get the local IP address on Debian 12:

ip r

 

2: How to Get an IP Address on Debian 12 Using ifconfig Command

The ifconfig is another command used to find the local IP address on Debian 12. To execute this command, you must install the net-tools utility on your system through the following command:

sudo apt install net-tools

Once the net-tools utility is successfully installed on your Debian 12, run the below command to get the IP address. The system will check the virtual, connected, and disconnected networks and display the IP address:

sudo ifconfig

In the above screenshot, the inet refers to the IPv4 address and inet6 refers to IPV6.

Another ifconfig command used to identify the IP address of each interface on your Debian 12 is written below:

/sbin/ifconfig

 

3: How to Get an IP Address on Debian 12 Using nmcli Command

Debian 12 uses the network manager command-line tool called nmcli to manage the network configurations of the system. You can use the following nmcli command to get an IP address from the terminal in Debian 12:

nmcli -p device show

 

4: How to Get an IP Address on Debian 12 Using hostname Command

The hostname command is also used to display the system’s DNS name and other system-related information such as IP address. To get the IP address of your system, execute the hostname command with the -I flag on Debian 12:

hostname -I

The IP address of the system should be printed on the console.

Note: The above methods will help you identify the private IP address of your device.

 

Bonus Method: How to Get Public IP Address on Debian 12

Besides getting the private IP address, you can also find the public IP address of your system by running the following curl command that provides you with complete information about your network including its public IP address:

curl ipinfo.io.

To get only a public IP address on Debian 12, use the following command:

curl ifconfig.io

 

Conclusion

The IP address is the specific address of any user working on the internet. In many cases, we need to know the IP address of our system as it is required to communicate with the other network users. On Debian 12, you can get the IP address through the terminal or the network settings. You can use numerous commands such as the ip command, ifconfig, nmcli, and hostname on the terminal to find the IP address. We have discussed these mentioned commands in the above section of this post.

Similar Posts