Smart Systems for Home

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

Linux Find Network Interfaces: Quick Command Guide

· 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

Yes, you can list every network interface on a Linux system with a single command, and you can view detailed information about each interface without installing extra tools. The core utilities ip and ifconfig are available on almost all distributions, and nmcli and ethtool provide deeper insight when needed.

What You’ll Need

  • A Linux machine with a terminal or SSH access.
  • Root or sudo privileges if you want to view or modify interface settings.

Step‑by‑Step

  1. Open a terminal window or connect via SSH to the target machine.
  2. Run ip link show. This command lists all network interfaces, both active and inactive, along with their state, MAC address, and index number. The output looks like:
    1: lo: LOOPBACK mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    2: eth0: UP mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default
    3: wlan0: DOWN mtu 1500 qdisc noop state DOWN mode DEFAULT group default
    
  3. To get a concise list of interface names only, pipe the output to awk:
    ip -o link show | awk -F': ' '{print $2}'
    This prints each interface name on its own line.
  4. For detailed status of a specific interface, use ip addr show dev <interface>. Example:
    ip addr show dev eth0
    The output includes IP addresses, subnet masks, broadcast addresses, and the MAC address.
  5. To view the current link speed, duplex, and driver information, run ethtool <interface>. Example:
    ethtool eth0
    If ethtool is not installed, install it with your package manager, e.g., sudo apt install ethtool on Debian‑based systems.
  6. For wireless interfaces, nmcli device status provides a quick overview of connection state, SSID, and signal strength.
  7. To see all interfaces managed by NetworkManager, run nmcli device show. This command lists every device, whether wired, wireless, or virtual, and displays properties such as MAC, IP, and connection profile.
  8. If you prefer the legacy ifconfig output, install the net‑tools package and run ifconfig -a. This lists all interfaces, including those that are down.
  9. When troubleshooting, use ping -I <interface> 8.8.8.8 to test connectivity from a specific interface. Replace 8.8.8.8 with any reachable IP.
  10. To monitor real‑time traffic on an interface, use sudo tcpdump -i <interface> or sudo iftop -i <interface> if iftop is installed.
  11. Finally, if you need to bring an interface up or down, use sudo ip link set dev <interface> up or down. Verify with ip link show again.

Common Mistakes

  • Assuming that ip link show only lists active interfaces. It actually shows all interfaces, but the state column indicates whether they are UP or DOWN.
  • Using ifconfig on systems where it is not installed by default. Modern distributions ship ip and nmcli instead.
  • Forgetting to prefix commands with sudo when modifying interface state or accessing detailed driver information.
  • Interpreting “state UNKNOWN” as an error. This is common for loopback or virtual interfaces that do not have a physical link.
  • Using ethtool on a wireless interface; it returns limited data and may not be useful.

Tips

  • Combine ip -s link to display statistics such as transmitted and received packets, errors, and collisions for each interface.
  • Use ip route show to see which interface is used for default traffic. The line ending with “default via … dev <interface>” indicates the primary route.
  • To quickly filter interfaces by type, pipe ip link show through grep, e.g., ip link show | grep -i eth for Ethernet devices.
  • When troubleshooting DNS, check /etc/resolv.conf to ensure the nameserver entries correspond to the correct interface’s network.
  • For persistent changes, edit /etc/network/interfaces on Debian‑based systems or create a NetworkManager profile in /etc/NetworkManager/system-connections/ for consistent behavior across reboots.

Troubleshooting

If an interface does not appear in ip link show, it may be disabled at the BIOS level or the driver may not be loaded. Check dmesg | grep <interface> for driver messages.

When ip addr show dev <interface> returns no IP address, the interface is not configured. Use nmcli device connect <interface> or edit the configuration file to assign a static address or enable DHCP.

For wireless interfaces that fail to scan, ensure the firmware is loaded and the wireless card is not blocked. Run rfkill list to see if the device is soft or hard blocked; unblock with sudo rfkill unblock all.

If ethtool reports “Link detected: no”, verify the physical cable and switch port. Use ethtool -i <interface> to confirm the driver is active.

When pinging from a specific interface fails, check the routing table with ip route show to ensure there is a route that matches the destination network via that interface.

Frequently Asked Questions

What is the difference between ip link show and ifconfig -a?

Both list network interfaces, but ip link show is part of the iproute2 suite and provides more detailed state information. ifconfig -a is legacy and may not be installed on newer systems.

How do I find the MAC address of an interface?

Run ip link show dev <interface>; the MAC address follows the link/ether keyword.

Can I list only active interfaces?

Use ip link show up or filter the output with grep 'state UP'. This displays only interfaces that are currently operational.

Is it safe to bring an interface down while the system is in use?

Bringing a critical interface down (e.g., the one used for remote SSH) will disconnect you. Only bring down interfaces that are not essential for current operations.

How do I check the link speed of a wireless interface?

Use iw dev <interface> link; the output shows the bitrate and signal quality.

What should I do if nmcli device status shows an interface as “unmanaged”?

It means NetworkManager is not controlling that device. Either configure it manually in /etc/network/interfaces or add a managed=true line in /etc/NetworkManager/NetworkManager.conf and restart the service.