Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Linux Show Network Interfaces Step-by-Step

· 5 min read · Home Networking

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

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

  1. 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.
  2. Use the ip command:
    • Run ip link show to list all network interfaces with their status (UP/DOWN). Example output includes lines like 1: lo: ... and 2: eth0: .... The lo interface is the loopback, used internally by the system.
    • Run ip addr show to see interfaces with IP addresses and other details. This includes IPv4 and IPv6 addresses if configured. Look for lines like inet 192.168.1.1/24 to see IPv4 addresses.
  3. Use the ifconfig command (optional):
    • Run ifconfig (if installed) to get a simpler view of interfaces with IP info. Interfaces appear with names like eth0, lo, and wireless interfaces like wlan0. If ifconfig is not found, install net-tools with sudo apt install net-tools (Debian/Ubuntu) or sudo yum install net-tools (RHEL/CentOS).
  4. Use nmcli (for NetworkManager users):
    • Run nmcli device status to see interface status and connection type. Example output includes NAME TYPE STATE followed by entries like eth0 ethernet connected or wlan0 wifi disconnected. This is useful for desktop users who rely on NetworkManager for managing connections.
  5. 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 wlan0 and can be redirected to a file with ls /sys/class/net > interfaces.txt for later use.
  6. Use lshw for detailed hardware info:
    • Install lshw with sudo apt install lshw (Debian/Ubuntu) or sudo yum install lshw (RHEL/CentOS). Run sudo lshw -class network to see detailed hardware information like driver versions, MAC addresses, and hardware status. This is especially useful for diagnosing driver or hardware issues.

Common Mistakes

  • Using ifconfig on modern systems without installing net-tools, leading to a "command not found" error. Many distributions no longer include ifconfig by default.
  • Forgetting sudo when running commands that require root permissions (though ip and ifconfig usually don't). However, some diagnostics like lshw require root privileges.
  • Mixing up ip link show and ip 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 show for 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 show and look for entries like wlan0 or wlx001122334455. Wireless interfaces often have names prefixed with wl or wlan.
  • Use ip route show to 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.txt for later inspection. This is useful when you need to share or document interface status.
  • Use nmcli -p to 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] up to bring an interface up (replace [interface] with the actual name, e.g., ip link set eth0 up). This can activate interfaces that appear as DOWN due to being unconfigured.
  • Interfaces appear as DOWN:
    • Use ip link set [interface] up to 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.
  • Command not found:
    • Install the missing tool (e.g., net-tools for ifconfig). Use apt-file search ifconfig or yum search ifconfig to 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.

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.