# Using a USB wifi antenna

**URL:** <https://forums.balena.io/t/using-a-usb-wifi-antenna/60329>\
**Category:** Product support\
**Created:** [January 29, 2020, 2:56pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329 "2020-01-29T14:56:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [January 29, 2020, 2:56pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/1 "2020-01-29T14:56:06Z")

</div>

Hi, I’m trying to use a USB wifi antenna to allow me to connect my device to a wifi signal at longer range.

My issue is that I can’t work out if the Pi is using the built-in wifi adapter, or using the antenna. I’ve tried running ifconfig but I can only see WLAN0 and not WLAN1.

Can anyone point me in the right direction?

---

<div class="post-metadata">

**Author:** ![gelbal](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/gelbal/32/1109_2.png) [@gelbal](https://forums.balena.io/u/gelbal)\
**Post date:** [January 29, 2020, 3:35pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/2 "2020-01-29T15:35:10Z")

</div>

Hi @GregorR1, let me share couple of links first. Here’s our networking documentation that might help you: [https://www.balena.io/docs/reference/OS/network/2.x/#networking-on-balenaos-2x](https://www.balena.io/docs/reference/OS/network/2.x/#networking-on-balenaos-2x)

Then here’s non-exhaustive list of supported wifi dongles – in case you have the option to try these out:

> **[balena-io/wifi-connect](https://github.com/balena-io/wifi-connect#supported-boards--dongles)**
>
> Easy WiFi setup for Linux devices from your mobile phone or laptop - balena-io/wifi-connect

Next, I’d suggest using NetworkManager on the device to scan and inspect the wifi adapter. The `nmcli` command, on its own, will show all interfaces and the connections they have. `nmcli c` provides a connection summary, showing all known connection files with the connected ones highlighted. `nmcli d` displays all network interfaces (devices).  
Another useful place to look for **NetworkManager** information is in the **journalctl** logs:

```auto
journalctl -fn 100 -u NetworkManager  

```

Let us know how your investigation goes and if we could help out further.

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [January 29, 2020, 3:44pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/4 "2020-01-29T15:44:12Z")

</div>

Hi gelbal,

Thanks for the links. I tried running the nmcli command and it returned this:

```
wlp1s0u1u1: connected to resin-wifi-01
        "Ralink n"
        wifi (rt2800usb), 98:3F:9F:19:0C:27, hw, mtu 1500
        ip4 default
        inet4 192.168.1.105/24
        route4 0.0.0.0/0
        route4 192.168.1.0/24
        inet6 fe80::3b0a:7d22:ad9d:cbaf/64
        route6 fe80::/64
        route6 ff00::/8

supervisor0: connected to supervisor0
        "supervisor0"
        bridge, 02:42:8C:E7:56:7C, sw, mtu 1500
        inet4 10.114.104.1/25
        route4 10.114.104.0/25
        inet6 fe80::42:8cff:fee7:567c/64
        route6 fe80::/64
        route6 ff00::/8

wlan0: disconnected
        "wlan0"
        1 connection available
        wifi (brcmfmac), 3A:BD:75:BA:CF:09, hw, mtu 1500

eth0: unavailable
        "eth0"
        ethernet (bcmgenet), DC:A6:32:2F:9C:A6, hw, mtu 1500

```

As you can see, it says that wlan0 is disconnected, however the device is using a wireless connection as the device is online and there is no ethernet plugged in. I’m not sure what I’m looking for regarding the logs.

---

<div class="post-metadata">

**Author:** ![garethtdavies](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/garethtdavies/32/2669_2.png) [@garethtdavies](https://forums.balena.io/u/garethtdavies)\
**Post date:** [January 29, 2020, 5:53pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/5 "2020-01-29T17:53:29Z")

</div>

Hi, can you paste the NetworkManager logs to see if anything stands out there e.g. `journalctl -n 200 -u NetworkManager`. Also, if you enable support access and send us the device UUID we can also take a look at the device for you.

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [February 5, 2020, 10:53am UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/7 "2020-02-05T10:53:33Z")

</div>

Hi Gareth,

I’ve enabled support access on the device with the USB dongle installed. The UUID is 945f7f8a2e99218efddae054005ccbcb

I just want to make sure that it is using the external wifi dongle, as opposed to the built in one as the distance to the router is too far for the built in wifi chip to handle.

Edit: The built in wifi chip on the pi is enough to connect it when the pi boots but it is not reliable and drops out a lot. it then is a hit or a miss whether it reconnects and sometimes has to be restarted. So we have remote access for now, but the device may go offline at any point. We do have someone on site tomorrow that would be able to restart the device in this case. But moving forwards we need to ensure that the pi is always using the USB dongle.

Thanks,  
Gregor

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [February 5, 2020, 1:15pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/9 "2020-02-05T13:15:05Z")

</div>

Hi Gregor,

The second interface name is called `wlp1s0u1u3`. It is not wlan1 because it is renamed by the systemd/udev on boot: [https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/](https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/)

You may bind connection to this interface by adding `interface-name=wlp1s0u1u3` to `[connection]` section of the NetworkManager connection profile for this connection. In this case it is `/mnt/boot/resin-wifi-01`. You may modify it with vi from a host OS terminal.

Here is some more documentation about setting up the connection profiles:  
[https://www.balena.io/docs/reference/OS/network/2.x/](https://www.balena.io/docs/reference/OS/network/2.x/)  
[https://developer.gnome.org/NetworkManager/stable/nm-settings.html](https://developer.gnome.org/NetworkManager/stable/nm-settings.html)

Please let us know if you have further questions.

Thanks,  
Zahari

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [February 5, 2020, 1:22pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/11 "2020-02-05T13:22:03Z")

</div>

Hi Majorz,

Thanks for the reply. So if I understand correctly the wlp1s0u1u3 is the external dongle? When I use “nmcli d” it is showing as disconnected.

I’ll try to bind the connection to resin-wifi-01. I’m concerned that the device goes offline and we don’t have access again until tomorrow. Hopefully, this all goes to plan and solves the issue.

Edit: I cant seem to find the right file in the /mnt/boot/ directory.

Thanks,  
Gregor

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [February 5, 2020, 1:40pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/12 "2020-02-05T13:40:06Z")

</div>

Hi Gregor,

Sorry it is `/mnt/boot/system-connections/resin-wifi-01`.

It is shown as `disconnected` because the other interface is currently connected to the network. Once the switch is done it will be the opposite.

You may indeed loose connectivity when you do the switch if something goes wrong, so it will be better if you have access to the device.

Good luck!  
Zahari

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [February 5, 2020, 1:41pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/14 "2020-02-05T13:41:49Z")

</div>

Hi Majorz,

I had literally just found it when I saw your reply. Can you remind me how I edit the file?

Also, if it goes wrong - do I just need to get someone to remove the USB wifi adapter so it will revert to the built in one?

Thanks,  
Gregor

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [February 5, 2020, 1:54pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/15 "2020-02-05T13:54:28Z")

</div>

You may open a host OS terminal and then do `vi /mnt/boot/system-connections/resin-wifi-01`. You will need some basic vim skills. Pressing `i` enters insert mode. Pressing `ESC` exits it. And then typing `:wq` will write the file and exit vim.

It will not revert to the built-in WiFi once this is applied. Also please note that WiFi drivers on Linux in general are quite unstable. If you rely on WiFi connection only you may or may not run into driver issues where your connection is lost, etc. This is depending on the dongle/driver quality. It is a trial and error scenario unfortunately.

Thanks,  
Zahari

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [February 5, 2020, 2:24pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/17 "2020-02-05T14:24:39Z")

</div>

Hi Zahari,

Thanks for the reply, I think I’ve managed to implement the changes to the file. Do I just restart the device to make it change to the new adaptor?

I assume that the adaptor name will never change?

Thanks,  
Gregor

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [February 5, 2020, 2:27pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/18 "2020-02-05T14:27:15Z")

</div>

You need to restart the device indeed.

The name will not change unless it is plugged into another USB port.

Thanks,  
Zahari

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [February 5, 2020, 2:28pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/20 "2020-02-05T14:28:08Z")

</div>

Okay brilliant. I’ll try that now and if it doesn’t work I can always get someone on site tomorrow to have a look at it.

Thanks,  
Gregor

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [February 5, 2020, 2:34pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/21 "2020-02-05T14:34:24Z")

</div>

I restarted the device, and ran the nmcli d command but its saying the wlan0 is still the adaptor in use. I checked the resin-wifi-01 file and it still has the interface-name=wlp1s0u1u3 line in it.

I’m not sure where I’ve gone wrong.

Thanks,  
Gregor

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [February 5, 2020, 2:39pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/22 "2020-02-05T14:39:00Z")

</div>

Can you enable support access again so that I can take a peek at the device?

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [February 5, 2020, 2:40pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/23 "2020-02-05T14:40:11Z")

</div>

That should be the support access granted again now.

Thanks,  
Gregor

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [February 5, 2020, 2:45pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/24 "2020-02-05T14:45:31Z")

</div>

You probably have not rebooted the device, is that so?

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [February 5, 2020, 2:46pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/25 "2020-02-05T14:46:14Z")

</div>

My apologies, I must’ve got confused between reboot and restart.

---

<div class="post-metadata">

**Author:** ![majorz](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/majorz/32/639_2.png) [@majorz](https://forums.balena.io/u/majorz)\
**Post date:** [February 5, 2020, 2:46pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/26 "2020-02-05T14:46:59Z")

</div>

No problem, let’s see how that goes…

---

<div class="post-metadata">

**Author:** ![GregorR1](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@GregorR1](https://forums.balena.io/u/GregorR1)\
**Post date:** [February 5, 2020, 2:49pm UTC](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329/27 "2020-02-05T14:49:24Z")

</div>

That seems to have solved it! Thanks for all of your help!

[Next page](https://forums.balena.io/t/using-a-usb-wifi-antenna/60329.md?page=2)
