The “IP” or “Internet Protocol” is a numerical value allocated to each network device connected to the Internet. An “IP” is the internet address of your device and without it, you cannot access the internet. Your ISP assigns the IP address referred to as the Public IP address to your router and the IP assigned by your router is called the Private IP Address.
The IP assigned to you is required by others to create a connection with your system. But the question is “How to Get/Find your IP address in Debian 12?”.
This guide aids the users to “Get IP Address (Private & Public) in Debian 12”.
How to Get the Private IP Address in Debian 12?
The “Private IP” address is assigned by the network router connected to your system. It is only visible within the network and it is uniquely identified only within the network. You can get/view the IP assigned to your system using the following approaches:
- Using the ip Command.
- Using the ifconfig Command.
- Via the nmcli Command.
- Via the nmtui Command.
- Using the hostname Command.
- Via the ip route Command.
- From the Network Settings.
Method 1: Using the ip Command
The “IP” command in Linux serves multiple purposes; it can do anything from viewing, adding, deleting, and managing the network interfaces. To list down all the interfaces and the IP addresses against them, run the below command:
ip a
You can also view the IP address in a more simplified way via the following command:
ip -br addr show
To view the IP address against a specified interface (enp0s3 in this case), run the below-mentioned command:
ip addr show enp0s3
Method 2: Using the ifconfig Command
The “ifconfig” command is a legacy command line utility to get network information. It is no updated and is now officially considered as “Dead” or “Depreciated”. However, you can still install it via the “net-tools”. To install the “net-tools”, run the below command:
sudo apt install net-tools -y
Now, execute the below command to get the IP address of all interfaces configured on your system:
sudo ifconfig
Method 3: Via the nmcli Command
The “nmcli” is a command-line utility for managing the “Network Manager” and viewing the information related to it. Using the “nmcli” command, you can get the IP address on your system, as seen below:
nmcli
Note: The “nmcli” is pre-installed on Debian 12.
Method 4: Via the nmtui Command
The “nmtui” is a GUI-based network management utility integrated into Debian 12. Apart from the network management, you can view the network’s properties including the IP address. To get your system’s IP address, use the “nmtui” command as follows:
nmtui
It now opens up a new window, select the “Edit a connection” option from here:
Next, choose the specified “Connection” or “Interface” against which you want to get the IP address:
Now, under the “IPv4” configuration, view the IP address of the system:
Note: Scroll down from the above screen to get the “IPv6”.
Method 5: Using the hostname Command
The “hostname” command lets you manage the system’s hostname and has many flags to view distinct system information. One of its flags is the “-I” flag that outputs the system’s IP, as seen below:
hostname -I
Method 6: Via the ip route Command
The “ip route” is a command line utility for Debian and other Linux distributions to manage the static routes in the routing table for the specific network interfaces. It can also output the network information that also includes the IP address. To view it, execute the below command:
ip route show table local
Method 7: Using the Network Settings | GUI
The “Network Settings” is where you can manage your system’s network by interacting with the GUI. It also displays the network information and to view the IP address from it, open the “Advanced Network” settings from the “Activities”:
Now, select the “Ethernet” or “Interface” against which you want to view the IP and double-click/tap it:
Next, use the “IPv4 Settings” tab or IPv6” tab according to your network’s configuration and view the IP in the “Addresses”, as seen below:
That’s all for the methods to get the “Private IP Address on Debian 12”.
How to Get the Public IP Address in Debian 12?
Your internet service provider or ISP provides the “Public IP” for your router. Your system uses this IP to connect with outside networks and you can view it online or using the “curl” command on Debian 12. The “curl” is a command-line tool currently in use for data transferring between the systems (to or from the servers).
Below are examples of using the “curl” command to get your Public IP Address in Debian 12.
Command 1
curl ifconfig.me
Command 2
curl api.ipify.org
To get the Public IPv4 address in Debian 12, use the below command:
curl -4 icanhazip.com
To get the IPv6 address in Debian 12, execute the following command:
curl -6 icanhazip.com
That’s all for the methods to get the “Public IP Address on Debian 12”.
Final Words
To get/view the IP address (Private) on Debian 12, use the command-line utilities like “ip”, “ifconfig”, “nmtui”, “nmcli”, “hostname” or “ip route”. You can get/view your Public IP address using the curl command. This guide has presented all the methods to get the IP address in Debian 12.