Linux Show Network Interfaces Step-by-Step
In this article
Viewing network interfaces in Linux helps you identify and troubleshoot network connections, confirm interface names, and check status. This guide shows how to display them using terminal commands. No special setup is needed—just a Linux terminal and basic permissions.
What You'll Need
- A Linux system (any distribution, e.g., Ubuntu, Debian, CentOS, etc.)
- Access to the terminal (console or GUI terminal emulator)
Step-by-Step
- Open the terminal: Press Ctrl+Alt+T on most desktop environments or find the terminal application. If you're using a headless server, connect via SSH first.
- Use the
ipcommand:- Run
ip link showto list all network interfaces with their status (UP/DOWN). Example output includes lines like1: lo:and... 2: eth0:. The... lointerface is the loopback, used internally by the system. - Run
ip addr showto see interfaces with IP addresses and other details. This includes IPv4 and IPv6 addresses if configured. Look for lines likeinet 192.168.1.1/24to see IPv4 addresses.
- Run
- Use the
ifconfigcommand (optional):- Run
ifconfig(if installed) to get a simpler view of interfaces with IP info. Interfaces appear with names likeeth0,lo, and wireless interfaces likewlan0. Ififconfigis not found, installnet-toolswithsudo apt install net-tools(Debian/Ubuntu) orsudo yum install net-tools(RHEL/CentOS).
- Run
- Use
nmcli(for NetworkManager users):- Run
nmcli device statusto see interface status and connection type. Example output includesNAME TYPE STATEfollowed by entries likeeth0 ethernet connectedorwlan0 wifi disconnected. This is useful for desktop users who rely on NetworkManager for managing connections.
- Run
- Use
ls /sys/class/net:- Lists all network interface names without extra details. This is useful for scripting or when you need interface names quickly. Output looks like
lo eth0 wlan0and can be redirected to a file withls /sys/class/net > interfaces.txtfor later use.
- Lists all network interface names without extra details. This is useful for scripting or when you need interface names quickly. Output looks like
- Use
lshwfor detailed hardware info:- Install
lshwwithsudo apt install lshw(Debian/Ubuntu) orsudo yum install lshw(RHEL/CentOS). Runsudo lshw -class networkto see detailed hardware information like driver versions, MAC addresses, and hardware status. This is especially useful for diagnosing driver or hardware issues.
- Install
Common Mistakes
- Using
ifconfigon modern systems without installingnet-tools, leading to a "command not found" error. Many distributions no longer includeifconfigby default. - Forgetting
sudowhen running commands that require root permissions (thoughipandifconfigusually don't). However, some diagnostics likelshwrequire root privileges. - Mixing up
ip link showandip addr show— the former shows device status, the latter includes IP and MAC addresses. Misusing them may lead to confusion about interface configuration.
Tips
- Use
ip -br link showfor a concise summary of interfaces. This is ideal for scripting or when you need a compact view of interface names and status. - Check for wireless interfaces using
ip link showand look for entries likewlan0orwlx001122334455. Wireless interfaces often have names prefixed withwlorwlan. - Use
ip route showto see routing info and the default gateway. The first line typically shows the default route and which interface is used for internet traffic. - Save output to a file with
ip link show > interfaces.txtfor later inspection. This is useful when you need to share or document interface status. - Use
nmcli -pto get a prettified output from NetworkManager commands. This makes reading the output easier on the terminal.
Troubleshooting
- No interfaces listed:
- Check if the network hardware is enabled (e.g., WiFi or Ethernet is not disabled via switch or BIOS). Some laptops have hardware switches for WiFi that need to be toggled.
- Try
ip link set [interface] upto bring an interface up (replace [interface] with the actual name, e.g.,ip link set eth0 up). This can activate interfaces that appear asDOWNdue to being unconfigured.
- Interfaces appear as
DOWN:- Use
ip link set [interface] upto activate them. This is useful if an interface is not automatically brought up at boot. - Check for hardware issues using
journalctl -k | grep [interface]for kernel logs. This can reveal driver or hardware problems like missing drivers or damaged hardware.
- Use
- Command not found:
- Install the missing tool (e.g.,
net-toolsforifconfig). Useapt-file search ifconfigoryum search ifconfigto find the correct package. - Verify the command's name and spelling in the package manager (e.g.,
apt search ifconfig). Some distributions may name packages differently or not include the command by default.
- Install the missing tool (e.g.,
Frequently Asked Questions
What's the difference between ip link show and ip addr show?
ip link show displays interface status (UP/DOWN) and hardware info like MAC addresses. ip addr show includes IP addresses, subnet masks, and interface status. Use ip link for low-level device status and ip addr for configuration details.
Why is ifconfig not available on my system?
ifconfig is deprecated in favor of ip, but you can install net-tools to use it. This is common on newer distributions that have moved to iproute2 for network management.
How do I check wireless interfaces?
Look for names like wlan0 or wlxi... in ip link show or ls /sys/class/net. Wireless interfaces often have names including wl or wlan and may be managed by NetworkManager or iw commands for wireless configuration.
Can I list only physical interfaces?
Yes — use ip -br link show or filter output with grep, e.g., ip link show | grep eth. This excludes loopback interfaces and focuses on physical ones like Ethernet or wireless cards.
How do I know which interface is the default gateway?
Run ip route show — the first line typically shows the default route and the associated interface. The line usually starts with default via [IP] dev [interface], indicating the interface used for external traffic.
What if I see multiple interfaces with the same name?
Check for naming conflicts or duplicate interfaces. Use ip addr show to see which IP addresses are assigned to each interface. Modern Linux systems often use predictable interface names like enp1s0 or wwp0s20f3 to avoid conflicts.