Page cover image

Network Manager

Network Manager on Raspberry Pi

Network Manager is a powerful tool for managing network connections on your Raspberry Pi.

It provides a user-friendly command-line interface called nmcli that allows you to configure and control network interfaces, connections, and devices.

Key Features of Network Manager

  • Automatically manages network connections

  • Supports various connection types: Ethernet, Wi-Fi, mobile broadband, VPN, etc.

  • Stores network configuration profiles

  • Provides a command-line interface (nmcli) and a graphical interface (nm-applet)

  • Integrates with systemd for service management

Using Network Manager on Raspberry Pi

Checking Network Manager status: To verify if Network Manager is running, use the following command:

nmcli -t -f RUNNING general

Listing available connections: To list all the connections Network Manager has, use:

nmcli connection show

Activating a connection: To activate a connection profile named "My Wi-Fi" on interface wlan0, use:

nmcli con up "My Wi-Fi" ifname wlan0

Deactivating a connection: To deactivate a connection on interface eth0, use:

mcli dev down eth0

Creating a new Wi-Fi connection: To create a new Wi-Fi connection named "Home Network" with SSID "MyHomeWiFi" and password "secretpassword", use:

nmcli dev wifi con "MyHomeWiFi" password "secretpassword" name "Home Network"

Modifying a connection: To modify the IPv4 method of a connection named "Ethernet Connection" to manual and set an IP address, use:

nmcli con mod "Ethernet Connection" ipv4.method manual ipv4.address "192.168.1.100/24"

Importing a VPN configuration: To import an OpenVPN configuration file, use:

nmcli con import type openvpn file /path/to/vpn.ovpn

Best Practices and Use Cases

Server Configuration

For server-like behaviour, where you want to disable automatic connection creation and ignore carrier detection, add the following to the Network Manager configuration file (/etc/NetworkManager/conf.d/server.conf):

[main]
no-auto-default=*
ignore-carrier=*

Unmanaging Devices: If you want to manually configure a specific interface (e.g., eth0) and prevent Network Manager from managing it, use:

nmcli device set eth0 managed no

Scripting and Automation

Network Manager's nmcli command-line interface is suitable for scripting and automation tasks. You can use it to configure network settings, activate/deactivate connections, and manage devices programmatically.

Desktop and Laptop Use

For desktop and laptop users, Network Manager provides a user-friendly graphical interface called nm-applet. It allows users to easily manage network connections, view connection status, and perform common network tasks.

VPN Integration

Network Manager supports various VPN technologies, including OpenVPN, PPTP, and Cisco-compatible VPNs. You can easily import VPN configurations and manage VPN connections using nmcli or the graphical interface.

Last updated

Was this helpful?