Network Information on Linux
This guide explains how to identify all relevant network information on
Linux using standard command-line tools.
It is designed to work correctly even when multiple network interfaces
are present (Ethernet, Wi-Fi, VPN, virtual interfaces).
All information in this guide is obtained using standard Linux networking commands available on most distributions.
Supported systems
This guide applies to most modern Linux distributions, including:
- Ubuntu
- Debian
- Fedora
- Arch Linux
- Linux Mint
- Raspberry Pi OS
Applies to systems using:
- Ethernet
- Wi-Fi
- VPN connections
What information you will find
This guide helps you identify:
- Local IP address (LAN)
- Router (gateway) IP address
- VPN IP address (if connected)
- MAC address (hardware address)
- The correct network interface to use
Commands used
Network information on Linux is obtained using the following commands:
ip addr
ip route
These commands display all network interfaces and routing information on the system.
How to run the commands
- Open Terminal
- Run:
ip addr
The output is divided into sections, one per network interface.
Understanding network interfaces
Each block in the output represents one network interface.
Common interface names on Linux include:
-
eth0, eth1
Ethernet interfaces (common on servers and Raspberry Pi) -
enpXsY
Ethernet interfaces (predictable naming on modern systems) -
wlan0
Wi-Fi interface (older naming) -
wlpXsY
Wi-Fi interface (modern naming) -
tun0, tunX
VPN interfaces (TUN-based VPNs) -
wg0
WireGuard VPN interface -
lo
Loopback interface (ignore)
Most systems show multiple interfaces. This is normal.
Which interface should you use?
In most cases, use:
- Ethernet interface (
eth0,enpXsY) → if connected by cable - Wi-Fi interface (
wlan0,wlpXsY) → if connected via Wi-Fi
Ignore interfaces that:
- Are named
lo - Do not show an
inetaddress - Are clearly virtual or unused
If a VPN is connected, an additional VPN interface (tunX, wg0) will
appear separately.
Local IP address (LAN)
The local IP address identifies the computer inside the local network.
To find it:
- Locate the active Ethernet or Wi-Fi interface
- Identify the line starting with
inet
Example:
inet 192.168.1.42/24 brd 192.168.1.255 scope global dynamic
Meaning:
- 192.168.1.42 → local IP address
/24→ subnet mask (255.255.255.0)
Typical local IP ranges:
- 192.168.x.x
- 10.x.x.x
- 172.16.x.x
Router (gateway) IP address
The router IP address is obtained using:
ip route
Example output:
default via 192.168.1.1 dev enp3s0
Meaning:
- 192.168.1.1 → router (default gateway)
- enp3s0 → interface used to reach the router
VPN IP address
A VPN IP address exists only when a VPN connection is active.
To find it:
- Look for interfaces such as
tun0,tun1, orwg0 - Identify the
inetvalue under that interface
Example:
wg0: inet 100.96.12.34/32 scope global
Notes:
- VPN IP is different from the local IP
- If no VPN interface appears, no VPN is connected
MAC address (hardware address)
The MAC address uniquely identifies a network interface.
To find it:
- Use the same interface used for the local IP
- Identify the line starting with
link/ether
Example:
link/ether 3c:52:82:9a:b4:1f brd ff:ff:ff:ff:ff:ff
Important notes:
- Wi-Fi and Ethernet interfaces have different MAC addresses
- MAC addresses do not change between networks
- VPN interfaces use virtual addresses