Introduction to NetworkManager
NetworkManager is the most widely used network management daemon in modern Linux distributions. Its main goal is to simplify the configuration of network interfaces, whether via cable, Wi‑Fi, VPN, or mobile connections, providing a consistent experience both on desktop and on servers.
What is NetworkManager?
NetworkManager is a service that runs in the background and monitors state changes of network devices. When it detects a new connection or a change in signal, it automatically applies the appropriate configuration according to profiles defined by the user or the administrator.
Architecture and components
The main daemon (NetworkManager) communicates with several components:
- nmcli: command-line interface for controlling and querying the state.
- nmtui: ncurses-based text interface, useful in environments without a graphical environment.
- nm-applet: desktop applet that shows the network status in the system tray.
- systemd: manages the service as a unit, allowing automatic start and restarts.
Managing connections with nmcli
nmcli is the most powerful tool for administrators. Some common examples:
- List devices:
nmcli device status - Show active connections:
nmcli connection show --active - Create a static Ethernet connection:
nmcli connection add type ethernet ifname eth0 con-name MyEthernet ipv4.method manual ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 - Activate a Wi‑Fi connection:
nmcli device wifi connect "SSID" password "password" - Restart the daemon:
sudo systemctl restart NetworkManager
Managing connections with nmtui
For those who prefer a visual interface without needing a graphical environment, nmtui offers keyboard-navigable menus:
- Run
nmtuifrom the terminal. - Select “Edit a connection” to modify parameters such as static IP, DHCP, or DNS servers.
- Activate or deactivate interfaces with a single key press.
Configuration files and profiles
NetworkManager stores profiles in /etc/NetworkManager/system-connections/. Each file has a keyfile format and contains sections such as:
- [connection]: name, type, and UUID.
- [ethernet] or [wifi]: medium-specific data.
- [ipv4] and [ipv6]: assignment method (auto, manual, disabled) and addresses.
- [proxy] and [vpn]: optional advanced configurations.
Editing these files directly is possible, but it is recommended to use nmcli or nmtui to avoid syntax errors.
Advantages over ifupdown and other methods
- Real‑time changes without needing to restart network services.
- Automatic detection of unplugged cables and reconnection when plugged back in.
- Unified management of wired, wireless, VPN, and mobile connections.
- Integration with the desktop via applets and notifications.
- Compatibility with network file systems such as NFS and with containers (Docker, Podman) by creating bridges and veth pairs.
Troubleshooting common issues
When the network is not working as expected, these steps help diagnose:
- Check the service status:
systemctl status NetworkManager - Review the logs:
journalctl -u NetworkManager -f - Verify if the device is managed:
nmcli device show eth0 | grep STATE - Ensure there are no conflicts with other managers (such as
wpa_supplicantrunning in manual mode). - Reset a problematic connection:
nmcli connection down id "MyConnection" && nmcli connection up id "MyConnection"