Smart Systems for Home

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

Linux List Network Interfaces and Details

· 6 min read · Home Networking

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

Listing network interfaces in Linux helps identify available connections and troubleshoot network issues. This guide shows how to use command-line tools to display interface names, statuses, and configurations.

What You'll Need

  • A Linux-based system (e.g., Ubuntu, Fedora, CentOS).
  • Access to a terminal or command-line interface.
  • Basic familiarity with Linux commands.

Step-by-Step

  1. Open the terminal.
    Press Ctrl + Alt + T or find "Terminal" in your application menu. On some systems, you may need to use the app launcher and search for "Terminal" or "Console". This is the main interface for running commands.
  2. Use the ip command.
    Run ip link show to list all network interfaces. This command shows interface names (e.g., eth0, ens33, wlan0) and their statuses (UP/DOWN). For example:
    1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: eth0:  mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
        link/ether 00:1a:2b:3c:4d:5e brd ff:ff:ff:ff:ff:ff
    
    Here, lo is the loopback interface, and eth0 is an active Ethernet interface.
  3. View detailed interface info.
    Run ip addr show to see IP addresses, MAC addresses, and other interface details. This is useful for confirming which interface is being used for internet access. Sample output includes:
    2: eth0:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether 00:1a:2b:3c:4d:5e brd ff:ff:ff:ff:ff:ff
        inet 192.168.1.5/24 brd 192.168.1.255 scope global dynamic eth0
    
    Here, eth0 has an IPv4 address of 192.168.1.5.
  4. Use ifconfig (if available).
    Some Linux versions still support ifconfig. Run ifconfig to see interface statuses and assigned IP addresses. If it's not recognized, install net-tools via sudo apt install net-tools or sudo dnf install net-tools depending on your distro.
  5. Check interface status.
    Run ip link show again to confirm whether interfaces are UP or DOWN. Interfaces with UP are active and transmitting data. Those with DOWN are inactive or disconnected.
  6. Use nmcli for NetworkManager users.
    If NetworkManager is installed, run nmcli device to list interfaces and their connection status. This is particularly useful on desktop systems like GNOME or KDE. Sample output includes:
    DEVICE      TYPE      STATE      CONNECTION
    eth0        802-3-ethernet connected  Home Network
    wlan0       wifi      disconnected --
    
    This shows eth0 is connected, and wlan0 is not.
  7. Optional: View interface files.
    Check /sys/class/net or /etc/network/interfaces for interface configurations. For example, ls /sys/class/net lists all available interfaces in the system. /etc/network/interfaces is used in Debian and Ubuntu to define static IP settings.

Common Mistakes

Here are common errors and how to avoid them:

  • Typo in command names.
    Commands like ip or ifconfig must be spelled correctly. Use tab completion in the terminal to avoid typos. For example, type ip l and press Tab to auto-complete to ip link.
  • Confusing interface names.
    Interfaces like eth0 and ens33 can look similar. Always check the full output to match interface names with IPs. For example, ip addr show dev eth0 gives details exclusive to that interface.
  • Running commands without privileges.
    Some commands require sudo. Add sudo before the command if you see permission errors. For example, sudo ip link set eth0 down requires elevated privileges.
  • Using outdated tools.
    Some distros have dropped ifconfig in favor of ip. Use ip for consistency across modern systems. If you must use ifconfig, install net-tools first.

Tips

  • Filter interface output.
    Use ip link show dev eth0 to focus on a specific interface. This is useful when you only care about a single device, such as a dedicated Ethernet or USB tethering interface.
  • Automate with scripts.
    Create a script to list interfaces on startup or during diagnostics. For example, create a file list_interfaces.sh and run it at boot to log interface status. Sample script:
    #!/bin/bash
    ip link show > /var/log/interfaces.log
    
  • Use grep for quick filtering.
    Run ip link show | grep UP to find only active interfaces. This is helpful in scripts or when interfaces are numerous.
  • Check wireless interfaces separately.
    Use iwconfig for wireless-specific info if needed. This command shows details like signal strength, encryption, and connection status for WiFi interfaces.
  • Combine commands for faster inspection.
    Use ip -br addr show to get a condensed view of all interfaces and their IP addresses. This is particularly useful for quickly identifying which interface is in use.

Troubleshooting

If commands do not return expected results, try these steps:

  1. Restart the network service.
    Run systemctl restart NetworkManager or systemctl restart networking, depending on your system. This can reset the state of interfaces and re-trigger network detection.
  2. Check system logs.
    Use journalctl -u NetworkManager to see if there are errors related to network interfaces. Logs often include driver issues or failed connection attempts.
  3. Verify command availability.
    Run which ip or which ifconfig to confirm the tools are installed. If not, install iproute2 or net-tools as needed. Use sudo apt install iproute2 or sudo dnf install iproute2 for installation.
  4. Scan for hardware issues.
    Use lspci | grep network to check if network cards are detected by the system. If no output is shown, the hardware may not be recognized or may have a missing driver.
  5. Check for missing drivers.
    If an interface is missing, use lsmod | grep -i e1000 (for Intel cards) or similar to see if the required kernel module is loaded. If not, load it with sudo modprobe e1000.

Advanced Interface Inspection

For deeper inspection, use the following commands:

  • ethtool for hardware diagnostics.
    Run ethtool eth0 to see detailed stats about the interface, including speed, duplex, and link status. This is useful for diagnosing issues like slow speeds or dropped connections.
  • nmcli for managing connections.
    If using NetworkManager, you can activate or deactivate interfaces with nmcli device set eth0 managed yes or nmcli device set eth0 managed no. This can isolate the interface from automatic configuration.
  • arp for local network inspection.
    Run arp -a to list devices on the local network. This is useful for identifying connected clients and their MAC addresses.

Frequently Asked Questions

1. What does ip link show display?

It lists all network interfaces along with their status (UP/DOWN), type (Ethernet, wireless), and other attributes.

2. Why does ifconfig not work on my system?

Some Linux distros (like Ubuntu) have replaced ifconfig with the ip command. Install net-tools to use ifconfig if needed.

3. How do I know which interface is my main one?

Look for the interface with an IP address assigned (e.g., inet 192.168.1.5). This is typically the active interface for internet access.

4. Can I list only active interfaces?

Yes. Run ip link show up to display only interfaces in the UP state.

5. What if I see no interfaces listed?

Check for hardware issues using lspci or ls /sys/class/net. If interfaces are missing, ensure drivers are installed and working.

6. How do I check wireless interface status?

Use iwconfig or ip link show wlan0 to check wireless interface details and status.