Smart Systems for Home

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

Linux Display 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. Additional Guidance: Interface Naming Conventions
  7. When to Use Specific Commands
  8. Real-World Example

Displaying network interfaces in Linux helps you identify and manage your system’s network connections. This guide shows you how to list network interfaces using built-in commands like ip, ifconfig, and lspci. You’ll learn how to quickly check which interfaces are active, their status, and basic configuration details—all from the command line. Whether you’re troubleshooting a connectivity issue, verifying interface names, or configuring networking manually, these commands provide the tools you need.

What You'll Need

  • A Linux system with command-line access (Debian, Ubuntu, Fedora, CentOS, Arch, etc.)
  • Basic familiarity with the terminal
  • Optional: Root or sudo privileges for certain commands
  • Optional: NetworkManager installed (if using nmcli)

Step-by-Step

  1. Open a terminal
    Press Ctrl + Alt + T or navigate to Applications > Terminal to launch the command-line interface. If you're using a remote server via SSH, ensure you're connected before proceeding.
  2. Use ip to list interfaces
    Enter the command:
    ip link show
    This lists all network interfaces along with their status (UP/DOWN). For example, you might see:
    1: lo: <LOOPBACK,UP,LOWER_UP> 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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
           link/ether 08:00:27:10:2b:9c brd ff:ff:ff:ff:ff:ff
        3: enp0s8: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
           link/ether 08:00:27:87:0e:0a brd ff:ff:ff:ff:ff:ff
    This shows three interfaces: lo (loopback), enp0s3 (Ethernet), and enp0s8 (Ethernet likely unplugged).
  3. Check detailed interface information
    To see more details, use:
    ip addr show
    This displays interface names, IP addresses, MAC addresses, and other relevant info. For example, you might get output like:
    1: lo: <LOOPBACK,UP,LOWER_UP> 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
           inet 127.0.0.1/8 scope host lo
               valid_lft forever preferred_lft forever
           inet6 ::1/128 scope host
               valid_lft forever preferred_lft forever
        2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
           link/ether 08:00:27:10:2b:9c brd ff:ff:ff:ff:ff:ff
           inet 192.168.1.2/24 brd 192.168.1.255 scope global dynamic enp0s3
               valid_lft 85264sec preferred_lft 85264sec
           inet6 fe80::a00:27ff:fe10:2b9c/64 scope link
               valid_lft forever preferred_lft forever
    This shows the loopback interface and the enp0s3 interface with an IPv4 address 192.168.1.2 and a MAC address 08:00:27:10:2b:9c.
  4. Try ifconfig (if installed)
    On older Linux systems or with certain distributions, use:
    ifconfig
    Note: ifconfig is deprecated on newer systems in favor of ip. If ifconfig is not found, it likely isn’t installed. You can install it with:
    sudo apt install net-tools
    or the equivalent for your distribution.
  5. Use lspci for hardware interfaces
    To see which network hardware is physically installed, run:
    lspci | grep -i net
    This lists network controller hardware details. For example:
    02:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Ethernet Controller
    This tells you the type of hardware present.
  6. Use nmcli on NetworkManager systems
    If your system uses NetworkManager, run:
    nmcli device show
    This provides interface status and connection details with NetworkManager. For example, you might see:
    GENERAL.DEVICE: enp0s3
    GENERAL.TYPE:   ethernet
    GENERAL.VENDOR: Intel Corporation
    GENERAL.MODEL:  82574L Gigabit Ethernet Controller
    ...
    This gives detailed information about the device and its connection status.

Common Mistakes

  • Forgetting to use sudo when needed
  • Mixing up ifconfig and ip commands
  • Not checking both ip link show and ip addr show for full visibility
  • Assuming all listed interfaces are active or functional
  • Not installing net-tools when using ifconfig

Tips

  • Use man ip or man ifconfig to explore full command options
  • Filter output with grep to find specific interfaces
  • Use alias to create shortcuts for frequently used commands
  • Check your system’s init system (SysVinit, systemd, etc.) for interface naming conventions
  • Use ip -s link to see statistics like packets sent and received

Troubleshooting

If the commands don’t return expected results, consider the following:

  • Command not found: Some distributions do not include ifconfig by default. Install net-tools with:
    sudo apt install net-tools
    or equivalent for your distribution.
  • No interfaces listed: Check if the network service is running:
    systemctl status networking
    or
    systemctl status NetworkManager
    depending on which service is used.
  • Interfaces not working: Ensure the interface is brought up with:
    sudo ip link set dev eth0 up
    (replace eth0 with your actual interface name).
  • No IP address assigned: Use ip addr add or configure via dhclient or dhcpcd to request an IP.
  • Duplicate interface names: Newer systems use predictable naming (e.g., enp3s0), which may confuse users. See grub config for legacy naming options.

Additional Guidance: Interface Naming Conventions

Linux uses predictable interface naming to avoid confusion with eth0, eth1, etc. Here’s what you might see:

  • enpXsY: en = Ethernet, pX = PCI bus number, sY = slot number
  • wlpXsY: wl = wireless, pX = PCI bus number, sY = slot number
  • lo: Loopback interface
  • virbr0: Virtual bridge created by libvirt for virtual machines

When to Use Specific Commands

Here’s when to use each command for best results:

  • ip link show: For listing interfaces and checking their state (UP/DOWN)
  • ip addr show: For detailed interface info like IP addresses and MAC addresses
  • ifconfig: For older systems or when you prefer a simpler interface
  • lspci: For identifying network hardware on your machine
  • nmcli device show: For users of NetworkManager who want a GUI-like experience from the terminal

Real-World Example

Suppose you are troubleshooting a connectivity issue and see the following from ip link show:

2: enp0s8: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
   link/ether 08:00:27:87:0e:0a brd ff:ff:ff:ff:ff:ff

The NO-CARRIER flag indicates that the interface is not connected to a network. You can bring it up with:

sudo ip link set dev enp0s8 up

Then request an IP address with:

sudo dhclient enp0s8

If this still doesn’t work, you may need to check physical connections or the network configuration file in /etc/network/interfaces (for Debian-based systems) or /etc/sysconfig/network-scripts/ifcfg-interface (for Red Hat-based systems).