GICT knowledge base
How to View and Configure Network Interfaces in Linux
Published
If you use Linux, whether you’re running a web server, a desktop, or just tinkering with a Raspberry Pi, you’ll eventually need to deal with networking. Maybe you want to check your IP address, set up a static IP for a home server, or troubleshoot a flaky Wi-Fi connection. Whatever your task, knowing how to view and configure network interfaces is a fundamental Linux skill.
Unlike some operating systems that hide networking behind layers of menus, Linux gives you direct access to see exactly what’s happening under the hood. With just a few commands, you can list every interface, check or change your IP addresses, manage Wi-Fi, enable or disable connections, and diagnose problems. Mastering these basics not only makes you self-reliant, but also unlocks the full potential of your Linux machine.
This guide will walk you through everything you need to know, from understanding what a network interface is to step-by-step instructions for viewing and configuring both wired and wireless networks. Real-world examples and troubleshooting tips are included, so you’re ready for anything.
Table of Contents
- What Are Network Interfaces in Linux?
- Why You Need to View and Configure Network Interfaces
- Listing Network Interfaces: The Most Common Tools
- Understanding Network Interface Details
- Checking Your IP Address and Connection Status
- Configuring Network Interfaces
- Saving and Applying Network Changes
- Troubleshooting Common Network Issues
- Real-World Scenarios and Tips
- Frequently Asked Questions (FAQ)
- Conclusion
What Are Network Interfaces in Linux?
A network interface is any point where your Linux system connects to a network. This could mean a physical Ethernet port, a Wi-Fi card, a USB Internet dongle, or even a virtual device used for VPNs or containers. Each interface acts like a doorway for your device’s network traffic.
Common interface names:
- eth0, enp2s0, eno1: Wired Ethernet interfaces.
- wlan0, wlp3s0: Wi-Fi interfaces.
- lo: The “loopback” interface (your local system, always 127.0.0.1).
- tun0, tap0: VPN or virtual interfaces.
Interfaces get their names based on hardware, Linux version, and distribution. Newer systems use longer, more descriptive names, while older ones often use the simple eth0/wlan0 style.
Why You Need to View and Configure Network Interfaces
Here’s why this skill matters:
- Troubleshooting: Quickly see if your connection is up or down.
- Customization: Set a static IP for a server or a device on your home network.
- Security: Disable unused interfaces or monitor suspicious ones.
- Performance: Adjust settings for better speed, lower latency, or specific network needs.
- Remote access: Configure a machine for SSH, VPN, or remote desktop.
Even if you mostly use graphical tools, knowing the basics at the terminal helps when things go wrong or when you’re managing servers without a GUI.
Listing Network Interfaces: The Most Common Tools
Let’s start by discovering what interfaces your system actually has. There are several ways to do this, and which you use often comes down to preference or what’s available.
Using the ip Command (Modern and Recommended)
The ip command is the standard for modern Linux networking.
List all interfaces:
ip link show
or, for short:
ip a
You’ll get output like:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 ... 2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ... 3: wlp3s0: <BROADCAST,MULTICAST> mtu 1500 ...
Using ifconfig (Older but Still Widely Used)
Ifconfig is still common, though it’s technically deprecated.
Show all interfaces:
ifconfig -a
If you get a “command not found” error, you can install it:
sudo apt install net-tools
Using nmcli (For NetworkManager-Controlled Systems)
On desktops and laptops, NetworkManager is the background tool managing connections.
List interfaces:
nmcli device status
You’ll see a table with device names and their state (connected, disconnected, etc.)
Using Graphical Tools
If you have a desktop environment:
- GNOME: Open “Settings” > “Network”
- KDE: Use “System Settings” > “Network”
- XFCE: “Settings” > “Network Connections”
You’ll see wired, wireless, and VPN interfaces, with status and configuration options.
Understanding Network Interface Details
Each interface entry shows a lot of information. Here’s what to look for:
- Interface name: (e.g., enp2s0, wlp3s0)
- State: UP (enabled), DOWN (disabled)
- MAC address: The unique hardware address (looks like 12:34:56:78:9a:bc)
- IPv4/IPv6 addresses: Assigned addresses (e.g., 192.168.1.100)
- MTU: Maximum Transmission Unit, usually 1500 for Ethernet
- Flags: (e.g., BROADCAST, MULTICAST, RUNNING)
Understanding these can help you diagnose issues or configure your network for specific needs.
Checking Your IP Address and Connection Status
Finding your IP address is one of the most common networking tasks.
Show all IP addresses:
ip addr show
or
ip a
Look for the inet line under the interface you’re interested in:
2: enp2s0: <...> inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic enp2s0
Here, 192.168.1.100 is your IP.
Check all IPv4 addresses only:
hostname -I
For wireless:
iwconfig
(If not installed, try: sudo apt install wireless-tools)
Check connection status:
nmcli device status
Loopback (your own machine): Always has IP 127.0.0.1 assigned to lo.
Configuring Network Interfaces
Configuring interfaces can mean enabling/disabling them, changing IP settings, or setting up advanced options. On Linux, you can do this live (changes last until reboot) or make them permanent (changes survive restarts).
Enabling and Disabling Interfaces
Bring an interface up (enable):
sudo ip link set enp2s0 up
Bring an interface down (disable):
sudo ip link set enp2s0 down
With ifconfig:
sudo ifconfig enp2s0 up
sudo ifconfig enp2s0 down
With nmcli:
nmcli device connect enp2s0
nmcli device disconnect enp2s0
Setting a Static IP Address (Temporarily)
With ip (until reboot):
sudo ip addr add 192.168.1.55/24 dev enp2s0
sudo ip route add default via 192.168.1.1
With ifconfig:
sudo ifconfig enp2s0 192.168.1.55 netmask 255.255.255.0
sudo route add default gw 192.168.1.1 enp2s0
Switching to DHCP (Get IP Automatically)
With dhclient:
sudo dhclient enp2s0
With nmcli:
nmcli con mod "Wired connection 1" ipv4.method auto
nmcli con up "Wired connection 1"
Configuring DNS Servers
Temporary (until reboot): Edit /etc/resolv.conf and add:
nameserver 8.8.8.8
nameserver 1.1.1.1
Permanent: Set through your network manager or edit the relevant config files for your distro.
Wireless Network Configuration
List available Wi-Fi networks:
nmcli device wifi list
Connect to a network:
nmcli device wifi connect "NetworkName" password "YourPassword"
Disconnect:
nmcli device disconnect wlp3s0
Replace wlp3s0 with your actual Wi-Fi device name.
Saving and Applying Network Changes
Live changes using ip or ifconfig are not persistent. After a reboot, settings revert.
To make permanent changes, edit configuration files or use your network manager’s “Edit Connections” dialog.
For most modern distros, NetworkManager or netplan (on Ubuntu) manages configs.
Example: Ubuntu with Netplan
Edit /etc/netplan/01-netcfg.yaml (or similar):
network:
version: 2
renderer: NetworkManager
ethernets:
enp2s0:
dhcp4: no
addresses: [192.168.1.55/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,1.1.1.1]
After editing, apply with:
sudo netplan apply
On older systems, edit /etc/network/interfaces.
On Red Hat/CentOS/Fedora, use /etc/sysconfig/network-scripts/ifcfg-INTERFACE.
Troubleshooting Common Network Issues
My interface is missing or shows DOWN
- Check for hardware problems: try unplugging/replugging cables, rebooting, or checking dmesg for errors.
- Make sure the driver is loaded (
lspci -korlsusb). - Bring the interface up with
sudo ip link set INTERFACE up.
I can’t get an IP address
- Try restarting the DHCP client:
sudo dhclient INTERFACE. - Check your router or DHCP server.
- Inspect /etc/network/interfaces or netplan files for errors.
My changes disappear after reboot
- Make sure you edited the correct config file for your distro.
- For temporary changes, remember they won’t persist—make them permanent if needed.
Wi-Fi doesn’t work
- Check if your wireless device is listed:
ip link showornmcli device status. - Try scanning for networks:
nmcli device wifi list. - Verify your kernel has the right drivers. Use
dmesg | grep firmwareto spot missing firmware.
DNS problems
- Try changing DNS servers in /etc/resolv.conf or through the network manager.
- Test with
ping 8.8.8.8(Google DNS) andping google.comto see if it’s a DNS or general network issue.
Real-World Scenarios and Tips
Assigning a Static IP for a Home Server
You want your Raspberry Pi to always have the same IP on your LAN, so you can SSH in reliably. Use netplan or network manager to set a static IP, specify a gateway, and set DNS servers.
Quickly Disabling Wi-Fi When Wired
Need to test if your Ethernet cable is working? Disable Wi-Fi:
nmcli device disconnect wlp3s0
Re-enable it later:
nmcli device connect wlp3s0
Checking Which Programs Use the Network
See which process is using each interface:
sudo lsof -i
Resetting a Stuck Network Connection
Restart network manager (for desktops):
sudo systemctl restart NetworkManager
Or reapply your Netplan config:
sudo netplan apply
Switching Between Multiple Networks
If you move your laptop between work and home, use:
nmcli connection show
nmcli connection up "Work Ethernet"
nmcli connection up "Home Wi-Fi"
Frequently Asked Questions (FAQ)
- Q: Why do interface names look different on different systems?
A: Newer Linux uses “predictable” names (like enp2s0) based on hardware location. Older systems use eth0, wlan0. It’s mostly cosmetic, but you can change naming rules if you prefer the old style. - Q: How can I see which interface is connected to the internet?
A: Useip routeorroute -n. The default route (0.0.0.0) points to your gateway, and the interface listed is your main connection. - Q: How do I set a static IP for Wi-Fi?
A: Use your network manager’s GUI, or edit the configuration as you would for Ethernet, specifying your wireless interface name. - Q: Can I have multiple active interfaces?
A: Yes, for example, you can use both Ethernet and Wi-Fi at once, but routing and priorities will affect which is used for outgoing traffic. - Q: How do I see my public IP address?
A: Use a service like:curl ifconfig.me
Conclusion
Networking doesn’t have to be intimidating on Linux. Once you know how to view, configure, and troubleshoot your interfaces, you’re empowered to handle everything from basic connectivity to advanced server setups. Whether you prefer a quick terminal command or a friendly GUI, Linux gives you the tools to stay in control.
Practice listing your interfaces, experiment with enabling/disabling them, and don’t be afraid to modify configurations as you learn. Save your changes carefully, keep a backup of config files, and remember—if something goes wrong, there’s almost always a way to fix it without reinstalling or rebooting.
With experience, you’ll find that network management becomes second nature. And whenever you’re stuck, the Linux community is just a forum post or chat away, ready to help you get connected.
Related guides
How to Set Up zram on a Small VPS
Configure zram on Ubuntu with kernel and swap checks. Understand compressed memory limits, monitor real use and avoid unsafe swap-file changes.
LinuxHow to Find Services That Need a Restart After Updates with needrestart
Find services using outdated libraries with needrestart on Ubuntu. Read restart reports, review automatic restart policy and plan maintenance safely.
LinuxHow to Limit a Linux Service’s Memory with systemd
Limit a Linux service with systemd MemoryHigh, MemoryMax and swap controls. Check cgroup support, diagnose pressure and remove only your own policy.
LinuxHow to Protect SSH with CrowdSec on Ubuntu
Protect SSH with CrowdSec on Ubuntu. Connect log detection to firewall enforcement and test temporary blocking without losing administrator access.
