What Is the Role of NetworkManager in Ubuntu?
The NetworkManager service in Ubuntu is the primary system daemon responsible for detecting, configuring, and managing network connections automatically. From switching between Wi-Fi networks to configuring static IP addresses and VPNs, NetworkManager abstracts complex networking tasks into a seamless experience for both desktop and server users. This article explores how NetworkManager works, its core features, and how to interact with it using both graphical and command-line tools.
Core Responsibilities of NetworkManager
NetworkManager designed to keep your Ubuntu system connected whenever possible. It constantly monitors network interfaces and takes action based on connectivity status and user preferences.
- Automatic Connection Switching: NetworkManager intelligently prioritizes connections. If you unplug an Ethernet cable, it will automatically attempt to connect to a known Wi-Fi network to prevent downtime.
- Interface Configuration: It handles DHCP requests, assigns IP addresses, configures DNS servers, and manages routing tables without requiring manual intervention from the user.
- VPN and Mobile Broadband Support: Through a modular plugin system, NetworkManager supports various VPN protocols (like OpenVPN, WireGuard, and L2TP) and mobile broadband connections (3G/4G/5G).
- Power Management Integration: When a laptop goes to sleep, NetworkManager gracefully disconnects from the network and rapidly re-establishes connections upon waking up.
NetworkManager vs. Netplan in Ubuntu
In modern versions of Ubuntu, networking is handled by a combination of tools. Understanding where NetworkManager fits is crucial for system administration.
- Netplan: This is Ubuntu’s default network
configuration abstraction renderer. It reads YAML configuration files
located in
/etc/netplan/. - NetworkManager: On Ubuntu Desktop, Netplan is typically configured to hand off control to NetworkManager, which then manages the interfaces dynamically.
- Systemd-networkd: On Ubuntu Server, Netplan usually
hands control over to
systemd-networkdinstead of NetworkManager, as servers generally rely on static configurations rather than dynamic, user-driven network switching.
How to Manage NetworkManager in Ubuntu
While NetworkManager operates quietly in the background, you can interact with it using three primary methods depending on your environment.
1. The Graphical User Interface (GUI)
On Ubuntu Desktop, NetworkManager powers the network icon in the top-right system menu. Clicking this icon allows you to select Wi-Fi networks, toggle airplane mode, and access the main Network Settings panel to configure proxies or IPv4/IPv6 settings.
2. The Command Line Tool (nmcli)
For terminal users and script automation, nmcli is the
official command-line interface for NetworkManager. It allows you to
view status, modify connections, and control network devices.
- To check overall network status:
nmcli g - To list available Wi-Fi networks:
nmcli device wifi list - To connect to a specific Wi-Fi network:
nmcli device wifi connect "NetworkName" password "YourPassword"
3. The Text User Interface (nmtui)
If you are using a terminal but prefer a visual interface over raw
commands, nmtui provides a simple, keyboard-driven text
menu inside the terminal. Running the nmtui command allows
you to edit connections, activate a connection, or set the system
hostname via an intuitive menu.