If the Pi will be used from the GUI destop or if it just needs to connect to one network and won't be moving around much, you don't need Network Manager. If you are likely to go mobile with your Pi and need to connect to multiple networks, consider using nmcli.
NetworkManager is a set of tools that make networking simpler. Whether Wi-Fi, wired, bond, bridge, 3G, or Bluetooth, NetworkManager allows you to quickly move from one network to another: once a network has been configured and joined, it can be detected and re-joined automatically the next time its available. Nmcli is just the command line interface, CLI, to NetworkManager.
After reading this guide, you may be interested in reading:
This procedure will disable your wifi connection until it is reestablished in NetworkManager. So you will need a console or Ethernet connection.
- Update your sources,
sudo apt-get update
- Install NetworkManager,
sudo apt-get install network-manager. This will install a number of other packages as well.
- Install links text-based browser to confirm on captive portals,
sudo apt-get install links.
- NetworkManager does not manage any interface defined in /etc/network/interfaces by default. The easiest way to manage some interfaces using NetworkManager is to comment them out.
sudo nano /etc/network/interfaces.
auto lo iface lo inet loopback # Managed by NetworkManager #iface eth0 inet manual # Managed by NetworkManager #auto wlan0 #allow-hotplug wlan0 #iface wlan0 inet dhcp # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
- Review the
sudo nano /etc/NetworkManager/NetworkManager.conffile. It should look similar to this. The previous interfaces file combined with the managed=false setting, informs NetworkManager to only manage interfaces that are not listed in interfaces.
[main] plugins=ifupdown,keyfile [ifupdown] managed=false
sudo reboot now.
- Check network connection status,
ifconfig wlan0and verify that the inet addr is empty.
- Start using nmcli by scanning the manual,
- There are 5 Objects but mainly, this guide uses connection and device. Learn more about these by,
nmcli con helpand
nmcli dev help.
nmcli dev statusdisplays a table. Notice that wlan0 is disconnected.
nmcli dev wifidisplays a table of available wifi access points.
- Connects may be added using nmcli, for example
nmcli con add con-name HOMEOFFICE ifname wlan0 type wifi ssid MYSSID, but I prefer to use nmtui.
sudo nmtuiprovides a text user interface that allows easy creation of wifi connection.
- Edit a connection.
- Add >> wifi
- Give your connection a name and set the fields needed for your access point.
- If you provided all the settings correctly and set the connection to connect automatically, it might already have connected. Check with
- Notice the changed out put from
nmcli dev statusand
nmcli dev wifi.
- Show active connections with
nmcli con show -a.
- Take down a connection with
sudo nmcli con down connection_nameand bring it back up with
sudo nmcli con up connection_name.
NetworkManager service control is via systemctl, therefore it may be enabled with
sudo systemctl enable NetworkManager and disabled with
sudo systemctl disable NetworkManager. The service may also be monitored using
sudo service NetworkManager [status|start|stop|reload|restart].
Learn more about NetworkManager and nmcli from these,