October 13, 2023

NetworkManager on Raspberry, easy start

Updated 2023-10-13 !

There is a "new kid in the block" called
NetworkManager(NM), configuration of network interfaces, which in OS "Bookworm", Debian 12, is replacing the former used dhcpcd.

NM isn't really new since the first public release was made 2004.

In this post I will write down some NM hints for an easy start since I didn't find any myself.


Intro
Despite the picture above is showing the new Raspberry Pi(Rpi) desktop interface, after install of NM, this post will use the NM command line interface(CLI). This is due to that the CLI can handle all setups.

For this post I have used a RPi 3, tested with both RPi OS Bullseye 64 bit and the latest Bookworm, Lite version with no desktop and no WiFi installed. After boot, connected via ethernet, you can check the interfaces with command "ip address" and 3 interfaces will show; lo, eth0, wlan0


Install
This step is valid for Bullseye ! (In Bookworm its installed by default)

Start with an update, and a reboot, so the setup for NM will be included

pi@NmTest:~ $ sudo apt update && sudo apt full-upgrade -y && sudo apt clean


Start with issuing command "sudo raspi-config" and then set WLAN country

5 localisation Options => L4 Wlan Country

continue with install of NM via 

6 Advanced Options => AA Network Config => 2 NetworkManager

and then reboot.

Configuration

Ethernet
With the NM command 

pi@NmTest:~ $ sudo nmcli connection show

NAME                UUID                                  TYPE      DEVICE 

Wired connection 1  97b37656-d655-3413-be99-4836c40087ba  ethernet  eth0   


With

pi@NmTest:~ $ nmcli connection show Wired_eth0

connection.id:                          Wired connection 1

connection.uuid:                        97b37656-d655-3413-be99-4836c40087ba

connection.stable-id:                   --

connection.type:                        802-3-ethernet

connection.interface-name:              eth0

connection.autoconnect:                 yes

connection.autoconnect-priority:        -999

connection.autoconnect-retries:         -1 (default)

......

......


all the parameters for the interface are shown. Exit with "Ctrl + c"

The defauIt name, connection.id: is changed with 

pi@NmTest:~ $ sudo nmcli connection modify "Wired connection 1" connection.id Wired_eth0


Which also shows the syntax for changes you want to do.

WiFi client
With 

pi@NmTest:~ $ sudo nmcli device wifi list

IN-USE  BSSID              SSID         MODE   CHAN  RATE        SIGNAL  BARS  SECURITY 

        DE:47:32:57:60:F7  Guapa        Infra  44    270 Mbit/s  85      ▂▄▆█  WPA2     

        E2:47:32:57:60:F7  Guapa_Guest  Infra  44    270 Mbit/s  85      ▂▄▆█  WPA2 


you can check available WiFi:s. If WiFi is just added use "sudo nmcli device wifi rescan" for an updated list. Then connect with 

pi@NmTest:~ $ sudo nmcli --ask device wifi connect Guapa

Password: ••••••••••

Device 'wlan0' successfully activated with '547eab05-1937-448c-9d6e-519428129752'.


Another variant could be "sudo nmcli device wifi connect "$SSID" password "$PASSWORD""

If you use the list command again you will see a ”*” in the ”IN-USE” column for the Guapa WiFi


Useful commands

pi@NmTest:~ $ sudo nmcli connection down Guapa

pi@NmTest:~ $ sudo nmcli connection up Guapa

pi@NmTest:~ $ sudo nmcli connection delete Guapa


Documentation


Additional setups
Another post using NM text UI and additional setups including AP STA 

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !