Linux Find Network Interfaces: Quick Command Guide
In this article
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
- Open a terminal window or connect via SSH to the target machine.
- 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
- 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. - 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. - To view the current link speed, duplex, and driver information, run
ethtool <interface>. Example:ethtool eth0
Ifethtoolis not installed, install it with your package manager, e.g.,sudo apt install ethtoolon Debian‑based systems. - For wireless interfaces,
nmcli device statusprovides a quick overview of connection state, SSID, and signal strength. - 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. - If you prefer the legacy
ifconfigoutput, install the net‑tools package and runifconfig -a. This lists all interfaces, including those that are down. - When troubleshooting, use
ping -I <interface> 8.8.8.8to test connectivity from a specific interface. Replace8.8.8.8with any reachable IP. - To monitor real‑time traffic on an interface, use
sudo tcpdump -i <interface>orsudo iftop -i <interface>if iftop is installed. - Finally, if you need to bring an interface up or down, use
sudo ip link set dev <interface> upordown. Verify withip link showagain.
Common Mistakes
- Assuming that
ip link showonly lists active interfaces. It actually shows all interfaces, but the state column indicates whether they are UP or DOWN. - Using
ifconfigon systems where it is not installed by default. Modern distributions shipipandnmcliinstead. - Forgetting to prefix commands with
sudowhen 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
ethtoolon a wireless interface; it returns limited data and may not be useful.
Tips
- Combine
ip -s linkto display statistics such as transmitted and received packets, errors, and collisions for each interface. - Use
ip route showto 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 showthroughgrep, e.g.,ip link show | grep -i ethfor Ethernet devices. - When troubleshooting DNS, check
/etc/resolv.confto ensure the nameserver entries correspond to the correct interface’s network. - For persistent changes, edit
/etc/network/interfaceson 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.