I have created a C++ wrapper on top of nmcli to connect 2 WiFi modules to WPA2 networks in Ubuntu 18. However, it adds a number postfix to the SSID. Example: My Network becomes My Network 1 and then this number keeps growing.

As I need to specify the ifname, the current command is nmcli -w 90 device wifi connect BSSID password AMAZING_PASSWORD ifname wlan0. I have also tried using nmcli connection up <name> ifname <my_interface>, but that requires me to actually connect both WiFi modules to the network previously, but that does not seem right. Are there any solutions that would avoid that number postfix or an easier way to implement the connection up without needing to previously connect both modules to the network?

1

There are 1 answers

4
ofirule On BEST ANSWER

You can set the connection name when connecting using:

#wlan0
nmcli -w 90 device wifi connect BSSID password AMAZING_PASSWORD ifname wlan0 name NAME_OF_CON_VIA_WLAN0
# wlan1
nmcli -w 90 device wifi connect BSSID password AMAZING_PASSWORD ifname wlan1 name NAME_OF_CON_VIA_WLAN1

You can see your list of connections using nmcli c. By default when connecting to a wifi network the SSID is also the connection name but you can change it