`nmcli connection up` seems to ignore `ap BSSID` option
I've observed this on Ubuntu 20.04, 18.04 and 14.04. I haven't tested other Linux flavors. Below testing was done with network-manager 1.22.10-1ubuntu1.
Per the man page, we should be able to, (with multiple APs visible,) connect to a specific access point with nmcli using existing connection info (i.e. a connection file exists in /etc/NetworkManager/system-connections). E.g.:
nmcli c up id BldgWifi ap AB:CD:EF:G1:23:45
Note: I am not looking to restrict my connections to a single BSSID, I am looking to tell NM to go ahead and jump to a BSSID of my choice (typically because better signal strength).
However, this doesn't work. As an example of what I'm seeing in the terminal:
user@somemachine:~$ iwconfig wlan0
wlan0 IEEE 802.11 ESSID:"BldgWifi"
Mode:Managed Frequency:5.18 GHz Access Point: 12:9F:C2:FF:8C:AE
Bit Rate=400 Mb/s Tx-Power=22 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off Link Quality=54/70 Signal level=-56 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:120 Missed beacon:0
user@somemachine:~$ nmcli d wifi | grep BldgWifi | head
12:9F:C2:FF:85:1B BldgWifi Infra 9 260 Mbit/s 89 ▂▄▆█ WPA2
12:9F:C2:FF:7B:13 BldgWifi Infra 1 260 Mbit/s 80 ▂▄▆_ WPA2
12:9F:C2:FF:7B:12 BldgWifi Infra 161 540 Mbit/s 74 ▂▄▆_ WPA2
12:9F:C2:FF:8D:B6 BldgWifi Infra 48 540 Mbit/s 70 ▂▄▆_ WPA2
12:9F:C2:FF:85:9F BldgWifi Infra 1 260 Mbit/s 69 ▂▄▆_ WPA2
12:9F:C2:FF:85:9E BldgWifi Infra 149 540 Mbit/s 69 ▂▄▆_ WPA2
12:9F:C2:FF:8D:B7 BldgWifi Infra 11 260 Mbit/s 67 ▂▄▆_ WPA2
12:9F:C2:FF:86:E6 BldgWifi Infra 36 540 Mbit/s 65 ▂▄▆_ WPA2
* 12:9F:C2:FF:8C:AE BldgWifi Infra 36 540 Mbit/s 65 ▂▄▆_ WPA2
12:9F:C2:FF:85:1A BldgWifi Infra 52 540 Mbit/s 54 ▂▄__ WPA2
user@somemachine:~$ nmcli c up id BldgWifi ap 12:9F:C2:FF:86:E6
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
user@somemachine:~$ iwconfig wlan0
wlan0 IEEE 802.11 ESSID:"BldgWifi"
Mode:Managed Frequency:5.18 GHz Access Point: 12:9F:C2:FF:8C:AE
Bit Rate=400 Mb/s Tx-Power=22 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=54/70 Signal level=-56 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:14 Missed beacon:0
To summarize the above:
- Initially connected to 12:9F:C2:FF:8C:AE
- Listed APs for the same SSID
- Attempted to connect to different AP 12:9F:C2:FF:86:E6
- Connection "succeeded"
- But connected AP is unchanged (most of the time; sometimes I can get it to change once, typically after restarting network-manager ¯\_(ツ)_/¯)
I went ahead and turned on DEBUG level logging, and captured the journalctl output for a brief interval (testing with Ubuntu 20.04 in this case). The only reference to the BSSID was the following DEBUG line:
Jun 07 09:51:37 freight100-0069 NetworkManager[3533923]: <debug> [1591548697.9353] device[cd7c5e37804a1014] (wlan0): roamed from BSSID 12:9F:C2:FF:86:E6 ("BldgWifi") to (none) ((none))
I've attached this DEBUG snippet, as well. (note, it was done for an attempt to connect to a third AP, so differs from the BSSIDs above)
As an attempted workaround, I also tried using nmcli d wifi connect 12:9F:C2:FF:86:E6
, which exhibits the same behavior.log_change