How to Get IP Address on Debian 12?


A device/machine that is connected to a network or the internet has a unique identifier called the Internet Protocol (IP) address. This address enables the machine to send and receive data from other machines on the same network or the internet. Getting your IP address is essential for setting up network-related applications, troubleshooting network issues, and sharing resources with other users.

There are some terminologies that users must know before getting an IP address on a Linux system.

Static IP Address: It doesn’t change automatically or remains fixed. You can manually configure it for your Debian system by following the guide.

Dynamic IP Address: It is automatically distributed by a DHCP server. It changes whenever users connect to the network. Debian can obtain an IP address dynamically using DHCP.

Private IP address: Allocated by your router to devices within the local network.

Public IP address: Allocated by your ISP, it identifies the network on the internet.

IPv4: The most common version, represented as four sets of numbers (e.g., 192.168.1.1).

IPv6: A newer version with longer addresses (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).

This article will demonstrate different ways to get/obtain IP addresses on Debian 12.

How to Get/Obtain IP Address on Debian 12?

IP addresses can be classified into various categories, such as IPv4 and IPv6, which are different versions of the Internet Protocol. Additionally, IP addresses can be acquired in different ways, such as static and dynamic, which are different methods of assigning them to devices.

Let’s start with the first method.

Method 1: Get/Obtain IP Address on Debian 12 Using ip address Command

One method to obtain the IP address of your Debian 12 system is to use the “ip address” command. It enlists information regarding the network interfaces, including the IP addresses of the system.

To quickly retrieve internal IP addresses, users can execute the below command:

ip address

Note: Users can also utilize the “ip a”, “ip addr”, or “ip address” based on their needs. You can also use the -4 option to show only IPv4 addresses, or the -6 option to show only IPv6 addresses:

ip -4 address

Alternatively, you can also use the ip command to obtain/get the IP address of specific network interface:

ip address show <connection-name>

In this way, users can obtain IP addresses on Debian 12.

Method 2: Get/Obtain IP Address on Debian 12 Using nmcli Command

nmcli is a NetworkManager command-line tool. To query network manager information, use this command:

nmcli device show

Look for the IP4.ADDRESS field to find your IP address which is 192.168.221.139/24.

Specify Connection Name/Network Interface

First, identify the connection name that you want to get the IP address for. For instance, using the connection, the name might be eth0 enp0s3 or ens33.

nmcli connection show <connection-name> | grep ipv4.address

 

It shows the IP address allocated/assigned to the connection, along with the subnet mask and gateway.

Method 3: Get/Obtain IP Address on Debian 12 Using hostname Command

The hostname command displays various information about the network configuration of your system, including IP address. To get all the IP addresses of your system, regardless of the connection name, use the -I or –ip-address option of the hostname command:

hostname -I

It prints the IP address of your system on the standard output.

Display all IP Addresses

You can also use the –all-ip-addresses option to show all IP addresses associated with your system:

hostname --all-ip-addresses

Alternatively, use the -fqdn option to show the IP address and the fully qualified domain name (FQDN) of your system. For example:

hostname --fqdn

This section has explained for getting/obtaining IP addresses on Debian 12.

Method 4: Get/Obtain IP Address on Debian 12 Using ip route Command

The “ip route” command shows the routing table of your network interfaces, which contains information about the destination, gateway, and source addresses. Look for the line starting with “default” via followed by your gateway IP address:

ip route

Specific Network Interface

To get the IP address of a specific interface, use the “ip route” command with the specific interface:

ip route show dev <interface>

For instance, get the IP address of the ens33 interface via the “ip route” command:

ip route show dev ens33

The src field indicates the source address, (IP address). In this case, it is 192.168.221.139 for ens33.

Method 5: Get/Obtain IP Address on Debian 12 Using Settings Menu (GUI)

To obtain the IP address of your system using the Settings menu, follow these steps:

Step 1: Launch Network Settings

Hit the network icon in the upper right corner of the Debian desktop (system tray). Navigate to “Wired Settings” to view detailed network interface information, including your internal IP address, MAC address, default route, and DNS settings:

Step 2: Click on Gear Icon

The IP address is found in the “Network” section of the Settings menu. Now, click on the “gear” icon next to it to open its settings:

Step 3: Click the Details Tab

In the network device settings window, click on the “Details” tab. It sees the IP address and other information about your network connection:

By following these methods, users can confidently identify their IP addresses on Debian 12, streamlining communication and troubleshooting processes.

Conclusion

The IP address of your system is the one that is assigned to the network interface that you use to connect to the internet. To get/obtain the IP address on Debian 12, use the “ip address”, “ip route”, “nmcli”, and “hostname” commands. Alternatively, users can utilize the Network Settings and get the IP address under the connection details. The easiest and recommended method to get/obtain the IP address on Debian 12 is using the ip command.

This guide has explained command line as well as graphical interface methods in detail.

.

 

Print Friendly, PDF & Email
Categories