Ubuntu List Network Interfaces Guide
In this article
You can list active and inactive network interfaces on Ubuntu using the command line tools `ip` or `ifconfig`. The most modern and reliable command is `ip link show`, which provides a comprehensive view of all network devices, their status, and assigned IP addresses without requiring any additional software installation. This guide covers the primary methods, interpreting the output, and troubleshooting common scenarios where interfaces might not appear as expected.
What You'll Need
- A computer running Ubuntu (Desktop or Server edition).
- Access to a terminal or command line interface.
- Basic understanding of command-line navigation.
Step-by-Step
- Open the Terminal: Press
Ctrl+Alt+Ton your keyboard to open the terminal window. Alternatively, you can search for "Terminal" in the application launcher menu and open it from there. - Run the List Command: Type the following command and press
Enter. This command uses the `ip` utility, which is part of the standard `iproute2` package included with Ubuntu.
ip link show
- Interpret the Output: The command will return a list of all network interfaces found on your system. Each line represents a device. Here is a breakdown of the typical output:
- Interface Name: The leftmost column shows the logical name of the network interface, typically prefixed with
enfor Ethernet,wlfor Wi-Fi, orlofor the loopback device. - State: The text following the interface name indicates its current state.
UPmeans the interface is active and functioning.LOWER_UPis a flag indicating the interface is up and ready to receive packets.DOWNmeans the interface is administratively disabled. - Hardware Address (MAC): The string of characters under
link/etheris the Media Access Control (MAC) address, a unique identifier for the network card. - MTU: The
mtuvalue (Maximum Transmission Unit) defines the largest packet size that can be sent over the interface without fragmentation.
- Alternative: Using
ifconfig: If you prefer the older `ifconfig` tool, you can usesudo ifconfig -a. However, note that `ifconfig` is often not installed by default on newer Ubuntu versions and may not show interfaces that are down or not configured.
Common Mistakes
- Not Using
sudoforifconfig: When using the `ifconfig` command, it is common to forget the `sudo` prefix. Without it, the command may output "command not found" or provide incomplete information. The `ip link show` command does not strictly require `sudo` for basic listing, but you may need it to change interface settings later. - Confusing Interface Names: Network interface names can change between reboots, especially on laptops with Wi-Fi cards. A device might be named
wlp3s0today andwlan0tomorrow. Always check the current list to find the correct name for your active connection. - Ignoring the Loopback Interface: The
lointerface is always present. It is a virtual loopback interface used for local communication. Do not confuse it with a real network card.
Tips
- Filter for Active Interfaces: If you only want to see interfaces that are currently turned on, pipe the output through the
grepcommand. For example,ip link show | grep 'state UP'will display only the interfaces with aUPstatus. - Check Physical Connections: For Ethernet interfaces, ensure the cable is securely plugged into both the computer and the router or switch. A loose connection can prevent the interface from showing an
UPstate. - Enable the Interface: If you see an interface listed as
DOWN, you can bring it up using theip link setcommand. For example, to enable theeth0interface, typesudo ip link set eth0 up.
Troubleshooting
If the `ip link show` command returns no output or you cannot find the expected network interface, consider the following troubleshooting steps:
- Check for Driver Issues: If a hardware device (like a Wi-Fi card) is not listed at all, it may require a driver. Install the appropriate drivers using the
ubuntu-drivers devicescommand and follow the recommended installation steps. - Verify Physical Hardware: Ensure the network card is properly seated in its slot if it is a PCIe card. For USB adapters, try plugging it into a different USB port.
- Inspect System Logs: Use the
dmesgcommand to view kernel messages. Look for errors related to the network hardware. For example,dmesg | grep -i ethwill filter for Ethernet-related messages. - Network Manager Status: On Ubuntu Desktop, the Network Manager service controls network interfaces. Ensure the service is running by typing
sudo systemctl status NetworkManager. If it is stopped, restart it usingsudo systemctl restart NetworkManager.
Frequently Asked Questions
Why is my Wi-Fi interface not listed?
This typically indicates a driver issue or a hardware problem. Ensure the Wi-Fi card is supported by Linux and that the correct drivers are installed.
What does the lo interface mean?
The lo interface is the loopback interface. It is a virtual device used for localhost traffic and is always present on Unix-like systems.
How do I change the interface name?
Interface names are assigned automatically by the system. Changing them permanently requires editing the network configuration files in the /etc/netplan directory, which is an advanced task.
Does the ip command work on all Linux distributions?
Yes, the `ip` command is part of the `iproute2` package and is widely supported across most modern Linux distributions, including Debian, Arch Linux, and CentOS.