How to Get IP Address on Debian 12

The Internet Protocol address is the unique address allocated to every machine connected to the Internet or in a network and it is used to identify the specific machine over the internet. 

This IP address is provided to the machine by the internet service provider known as the IPS in the form of the numeric address such as 192.128.12.1.  This number consists of four sets, ranging between 0 to 255. 

All the devices connected to the internet share information with each other with the help of this IP address, moreover, the most common usage of the IP address are:

  • Allows to build a connection with the internet 
  • Allows users to share the information over different devices 
  • The location of the machine can be identified with the IP address

After these usages, it can be known why the IP address is important to be known to its user. This blog will explain different approaches through which the users can get and know the IP address of their machine if the Debian OS is installed on it. 

Also, this blog will explain the sections mentioned in the below outline:

  1. What are the Types of the IP Address
  2. What are the Versions of the IP Address
  3. What are the Methods to Find IP Address on Debian
  4. Method 1: Get IP Address Using the ip address Command
  5. Method 2: Get IP Address Using the ifconfig Command
  6. Method 3: Get IP Address Using the nmcli Command
  7. Method 4: Get IP Address Using the hostname Command
  8. Method 5: Get IP Address Using the ip route Command
  9. Method 6: Get IP Address Using the Settings Menu

Let’s start the article by exploring different types of IP addresses. 

What are the Types of the IP Address?

This section will explain two different types of the IP address on Debian Linux that are the private and the public IP address. 

Public IP Address: It is the address that is assigned to the router by the internet service provider and is allocated to every machine connected to that specific router, moreover, it is also used by the internet to identify your network. 

Private IP Address: This is the address that is allocated to every Internet of Things IoT including smartphones and laptops by the router. This address is used by the router to recognize the machine connected to it. 

What are the Versions of the IP Address?

Two different versions of the IP Addresses, one is known as the IPv4 and the other is known as the IPv6 have been explained in this section

The IPv4 is a 32-bit address but when the number of IoT devices increased, then the IPv6 was introduced that is of 128-bit. Users can differentiate between both addresses because the IPv4 contains dots whereas the IPv6 contains the colons between them. Moreover, both are numeric addresses but the IPv6 also contains some alphabets in it. 

What are the Methods to Find IP Addresses on Debian?

Different ways including the command line and graphical user interface can be used to get the IP address on Debian and all these methods are explained in this section with their demonstration. 

Method 1: Get IP Address Using the ip address Command

The mentioned above IP Address1342 is used to display the information of the IP’s of the machine and to find the IP address of the machine, run the command:

$ ip address

The users can also the short form of the above command which is shown next:

$ ip addr

Or simply one can run the command:

$ ip a

The output of all three commands is the same and it will display the IP address of the machine on the screen. 

Method 2: Get IP Address Using the ifconfig Command

The next method to display the IP address on Debian is by using the ifconfig command. This command is used to configure the internet protocols on Debian. To display the IP address using this command, use the command:

$ sudo ifconfig

If this command is not installed on the computer, then you are requested to install the net-tools package with the following command:

$ sudo apt install net-tools -y

Method 3: Get IP Address Using the nmcli Command

The “show” option of the nmcli command can be used to display the IP address of the machine on Debian. For example, run the below-mentioned command to display the IP address:

$ nmcli -p device show

The IP address will be displayed on the screen, but if it displays the error “nmcli: command not found”, then install it by running the command:

$ sudo apt install network-manager -y

Method 4: Get IP Address Using the hostname Command

The hostname command is used to extract the information of the local machine and to use this command for displaying the IP address, use the “I” option of this command as shown:

$ hostname -I

Method 5: Get IP Address Using the ip route Command

The ip route command can also be used to display the IP address on Debian with the following command:

$ ip route

Similar to the IP address command, the short form of the ip route command can also be used to get the same above output:

$ ip r

Method 6: Get IP Address Using the Settings Menu

This is the graphical user interface method and can be used by new users as well. To use this method, first open the “Settings” from the applications menu:

Now click on “Network” from the left-most menu:

Click on the “gear” icon as shown in the next figure:

The IP address has been displayed in the “Details” section:

These six methods can be used to get the IP address on Debian. 

Conclusion

To get the IP address on Debian 12, use the ip address command, ip route command, nmcli command, ifconfig command, and the hostname command. Also, the IP address can be found in the “Network” section of the Settings of Debian. 

The IP address is important to be known as it is used to connect the machine with the local network. Also, it is used to troubleshoot the networks on Debian.

This post has explained all the possible methods including the command line and graphical user interface to get the IP address on Debian.