Add new network to Known WiFi Networks in advance

Does anyone know how to add a WiFi (client) network in advance, without using Scan?
I want to add a network SSID and password in advance to the “Known WiFi Networks” list (on my GL-AR750) in the Internet section of the GUI. I tried doing a scan then selecting Other, and filling in the details. You then have to press Join, this then times out (as the network isn’t present) and then doesn’t remember the network.
I would like to be able to do this so I can give the router to a non-expert and it will just connect to a network at a new location without me having to be there or them having to log in to the router interface.

I am happy to use the Luci interface or SSH in and edit files (now where’s my VI crib sheet :slight_smile: )
Thanks,
Adrian.

Hi,
You should edit the following files:

/etc/config/ssids
/etc/config/wireless

The best way should be to join from a network from the GUI with the same characteristics 2GHz or 5GHz as your non-expert user network and then edit those files filling the right network name and the password in both files.

Also delete the line with option bssid ‘XX:XX:XX:XX:XX:XX’ in the /etc/config/wireless

Regards.

Victor

Hello Victor, thanks for the reply. I found the files. It looks as though the only one you need to edit is the ssids file. This is the one that contains the Saved networks. the wireless file seems to get overwritten when the router reboots.
I got an unseen network to appear in the saved networks file (by adding it to the ssids file, but so far I haven’t managed to get it to automatically connect without selecting the network and clicking “Join”.

There is an option in ssids…
option trycount ‘0’

Which I can’t find any reference to, but ‘0’ seems to be the option for all networks.

I will keep investigating.

Thanks again,
Cheers,
Adrian.

Hi Adrian,

The autoconnect feature, it looks that only works if the interface sta with wlan-sta are present on the wireless file, periodically it will go through the saved networks until it manages to connect.

See this example for the end of wireless file for a 5Ghz network:

config wifi-iface ‘sta’
option device ‘radio0’
option network ‘wwan’
option mode ‘sta’
option ifname ‘wlan-sta’
option ssid ‘NET’
option bssid ‘xx:xx:xx:xx:xx:xx’
option channel ‘157’
option encryption ‘psk2’
option key ‘mypassword’
option disabled ‘0’

Then I have join another saved network this time 2.4GHz

config wifi-iface ‘sta’
option network ‘wwan’
option mode ‘sta’
option ifname ‘wlan-sta’
option ssid ‘NET’
option bssid ‘xx:xx:xx:xx:xx:xx’
option channel ‘6’
option device ‘radio1’
option encryption ‘psk2’
option key ‘Mypassword’
option disabled ‘0’

If you join other network will overwrite the values again but keeping the same interface all the time.

The GL scripts, every time that you click on join a network and success, it will overwrite and create the same interface on the wireless file but with new network name and new password.

For example if you scan and join a network successfully then it will show the new network in both files, if you delete the network from the saved networks file and reboot the router, the router will join automatically the last network as the wireless file stays the same when you reboot the router.

But each time you try to scan and join a network both files will be overwritten again, adding the network on the ssid file and rewrite the wireless file.

So basically the auto connect feature only works if the sta interface is present in the wireless file and then it will go through the ssid file saved networks until success, if you add the correct values of your new network on the ssid file it should be work out of the box for your non-expert user, only you have to at least connect one time to any network to have the interface create on the wireless file

You can go on luci and you will see how GL scripts worked, you will see a new interface wwan part of firewall zone of wan and wan6 and a wireless connection wlan-sta that has been created for the network.

Just modify the values of the wireless network filling your non-expert network user, name and password and let empty the BSSID

If they do not use the GL gui it should work and connect automatically.

Another option to avoid conflicts with the GL scripts is to create another wireless connection with different name than sta , wlan-sta and also different than wwan for the interface.

This is how you do for other routers with only openwrt installed.

Honestly if the router is just intended to be used for travel, the best option is trust in your non-expert user and explain how to join a network from the GL gui, normally they are not interested in the rest of options, only want to have access to the network.

Long story, :pensive: I hope this helps.
Regards.
Victor.