Linux See Network Interfaces How-To
In this article
Linux See Network Interfaces allows you to list and identify all active and inactive network devices on your system. This is useful for network diagnostics, configuration, and troubleshooting. You’ll learn how to use built-in Linux commands to view this information accurately and efficiently.
What You'll Need
- A Linux-based operating system (e.g., Ubuntu, Debian, CentOS, etc.)
- Access to a terminal or command-line interface
- Basic familiarity with terminal commands
- Internet access to install tools if needed
Step-by-Step
- Open your terminal by searching for it in your application menu or using a keyboard shortcut like Ctrl + Alt + T.
- Type the command
ip link showand press Enter. This command lists all network interfaces along with their current status (UP or DOWN). For example, you might seelo(loopback),eth0(Ethernet),wlan0(Wi-Fi), and possibly virtual interfaces likedocker0orbr-for container or bridge networks. - Alternatively, run
ip addr showto see detailed information, including IP addresses assigned to each interface. This helps when verifying if an interface is receiving or using a network address. For example,inet 192.168.1.5/24means the interface has been assigned an IPv4 address. - For a more concise list, try
ls /sys/class/net, which shows only the names of available network interfaces. This is particularly useful in scripting or when you need just the names without extra details. - To get driver and hardware information about each network interface, use
lspciorlshwwith sudo if needed. For example,lspci -vmay reveal the manufacturer and driver in use for a network card.
Common Mistakes
- Forgetting to run commands with
sudowhen hardware or system details are needed. Some commands likelspciorlshwmay return incomplete or permission-denied errors without elevated privileges. - Mixing up commands like
ipandifconfig(the latter is deprecated in many distributions). Whileifconfigis still available in some systems, it lacks the modern features ofipandiproute2. - Not checking both active and inactive interfaces, which can be missed when only using
ip linkwithout flags. For example, a newly added interface may not appear in the default output unless explicitly queried.
Tips
- Use
ip link setorup downto enable or disable an interface if needed. This is useful when testing connectivity or rebooting networking services. - Check
/etc/network/interfacesornmcliif you're using NetworkManager for network configuration. This helps when manually or automatically managing network settings across reboots. - Use
man ipin the terminal to read the full manual of theipcommand for advanced usage. Theiptool is highly flexible and supports many other operations like route management and tunneling.
Troubleshooting
If your commands don’t return expected results:
- Verify that your system is up to date with
apt update && apt upgrade(Debian/Ubuntu) oryum check-update(CentOS). Sometimes, outdated tools or kernel modules can cause unexpected behavior. - Ensure that the
iporifconfigtool is installed. If not, installiproute2ornet-toolsusing your package manager. For example,sudo apt install net-toolson Debian-based systems. - Try running commands as root with
sudoif permissions are an issue. Some network tools require elevated privileges to access hardware or system-level data. - Check for typos or incorrect interface names in commands. For example, using
eth1when the correct interface isenp0s3can result in no output or errors.
Frequently Asked Questions
What is the difference between ip addr show and ip link show?
ip addr show displays IP addresses and interface details, while ip link show shows only interface names and status.
Can I use ifconfig instead?
Yes, but ifconfig is deprecated in many modern Linux distributions. Use ip commands instead for better compatibility and more features.
How do I see only active interfaces?
Add state UP to the command: ip link show state UP to display only interfaces currently active.
Why don’t I see any interfaces listed?
Check if your hardware is properly detected and not disabled in BIOS/UEFI or if the kernel module is loaded with lsmod | grep .
What if I see no IP address assigned to an interface?
Use ip addr add to assign one manually for testing, or check your network manager or config files.
Can I filter by interface type?
Yes, by using ip link show or filtering output with grep or awk in scripts.