Whether you're configuring a network or troubleshooting connectivity, knowing your device’s local IP address is essential. This guide outlines three practical methods to retrieve your IPv4 and IPv6 addresses on Linux systems.
Method 1: Using the Terminal with ip addr
Open your Terminal.
Type the following command and press Enter:
ip addr show
Locate the inet entry for the IPv4 address and the inet6 entry for the IPv6 address under your active network interface (commonly eth0, wlan0, or similar).
An IPv4 address typically looks like 192.168.1.6, with /24 indicating a subnet mask of 255.255.255.0.
An IPv6 address will include a prefix such as /64.
If the iproute package is not installed, use your distribution’s package manager to install it:
Distribution Installation Command
Debian-based sudo apt install iproute2
Red Hat-based sudo dnf install iproute
Arch-based sudo pacman -S iproute2
openSUSE-based sudo zypper install iproute2
Method 2: Using NetworkManager via nmcli
Open your Terminal.
Type the following command and press Enter:
nmcli device show
Look for IP4.ADDRESS and IP6.ADDRESS entries under your active network interface.
The IPv4 address will resemble 192.168.1.6, with /24 indicating the subnet mask.
The IPv6 address will include a prefix like /64.
If NetworkManager is not installed, you can install and enable it using:
Distribution Installation Command
Debian-based sudo apt install network-manager
Red Hat-based sudo dnf install NetworkManager
Arch-based sudo pacman -S networkmanager
openSUSE-based sudo zypper install NetworkManager
After installation, start and enable the service:
sudo systemctl start NetworkManager
sudo systemctl enable NetworkManager
Method 3: Using the Graphical Interface
Open your system settings.
Navigate to the network settings section.
Look for connection details or information — your IPv4 and IPv6 addresses will typically be listed there.
These methods offer reliable ways to identify your device’s local IP address on Linux, whether you prefer command-line tools or graphical interfaces.
Understanding your IP configuration is a foundational step in managing Linux networks efficiently. Keep this reference handy for future setups or diagnostics.