Skip to content

Setting up External Wi‐Fi Adapter for Archiving

Alexey Yudichev edited this page Sep 14, 2024 · 3 revisions

This guide may help people who choose to use an external Wi-Fi adapter on a board that already has an integrated Wi-Fi. This can be useful if your archiving operation does not complete in time before the car sleeps, or you prefer a higher throughput connection for whatever reason. In this setup, the integrated Wi-Fi card is used for Access Point functionality. If the latter is not needed, you may disable the integrated Wi-Fi completely (in which case the guide below will need to be corrected as your interface names will change). This has been tested on a Raspberry Pi 4B and assumes the standard "one step setup" as a starting point.

  1. Ensure your external card works, i.e. install or compile drivers if needed, ensure wlan1 interface is present by executing iwconfig. I used a BrosTrend adapter, so just followed https://linux.brostrend.com.
  2. rm /etc/udev/rules.d/70-persistent-net.rules as no need to create the ap0 alias anymore.
  3. edit /etc/dnsmasq.conf:
interface=lo,wlan0
no-dhcp-interface=lo,wlan1
#bind-interfaces
bogus-priv
dhcp-range=192.168.66.100,192.168.66.150,12h
# don't configure a default route, we're not a router
dhcp-option=3
  1. edit /etc/hostapd/hostapd.conf, here are only the differences. Note that I use RPi 4B with 5GHz ac card, so I set it up for max speed:
interface=wlan0
# "a" simply means 5GHz
hw_mode=a
# 802.11ac and 802.11n support
ieee80211ac=1
ieee80211n=1
# the channel to use, automatic (0) didn't work
channel=36
  1. edit /etc/network/interfaces and comment out or remove everything related to ap0:
#auto ap0
#allow-hotplug ap0
#iface ap0 inet static
#    address 192.168.66.1
#    netmask 255.255.255.0
#    hostapd /etc/hostapd/hostapd.conf
  1. edit /etc/dhcpcd.conf and replace ap0 with wlan0 and add IP configuration, the end will look like this:
interface wlan0
static ip_address=192.168.66.1/24
nohook wpa_supplicant

There has been a report of the following alternative way of configuring wlan0 that works (the steps below replace the corresponding steps above): 5. edit /etc/network/interfaces and replace ap0 with wlan0 so that it looks like this:

source-directory /etc/network/interfaces.d

auto lo
auto wlan0
iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet static
    address 192.168.66.1
    netmask 255.255.255.0
    hostapd /etc/hostapd/hostapd.conf
  1. edit /etc/dhcpcd.conf and replace ap0 with wlan0 at the end of the file:
interface wlan0
nohook wpa_supplicant