Quick way to switch to a USB WiFi adaptor on your Raspberry Pi

I wrote a long winded guide to this in a previous post, but I've since though of a better way if you already have you onboard WiFi adaptor connected to your network.

You also don't need an ethernet connection and can be running headless, simply head over to this directory:

cd /etc/NetworkManager/system-connections
ls -l

you should then see a file with you current connection details, it will either be called preconfigured.nmconnection if you set it up from the RaspberryPi installer when you created you SD card image or just the SSID of the connection. You may have multiple entries here if you've connected to other networks. Next of your double check the name of your WiFi device by running

ip a s

Your onboard should be wlan0 and your usb device if it has been recognised would be wlan1, then we can edit the file

sudo nano preconfigured.nmconnection

and simply add a line 'interface-name=wlan1'  under [connection] to specify the device:

[connection]
id=preconfigured
uuid=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
type=wifi
interface-name=wlan1
[wifi]
mode=infrastructure
ssid=......

the [Ctrl]+[O] and [Ctrl]+[X] to save and exit, then finally we can reboot

sudo reboot now

Note that you IP address will have probably changed now to if you are SSH'ing on to the device you should use you broadcast hostname (raqspberrypi.local) or hopefully you've pre-configured a static IP address in your router's DCHP or you can just log into your router to check.

Either way you whe your system is up we can check the connection:

ip a s

And you should be set.

Tags : raspberrypi wifi usb network

Subscribe to newsletter

Search Posts

Back to top