cobaltowl

We'll cross that bridge when we find it

Creating a WiFi hotspot/repeater using a Beaglebone

20-08-2023


Pre-prequisites

This is optional, but I wholeheartedly recommend you update your kernel, remove Cloud9/Node and update all packages:

apt remove c9-core-installer npm nodejs
apt autoremove
apt update
apt upgrade
cd /opt/scripts
git pull
tools/update_kernel.sh
shutdown -r now

We’re removing Cloud9 since it won’t be used (and honestly, most people who buy a Beaglebone won’t be using either HDMI and C9), but you can skip that part if you want.

Prerequisites

Update bridge-utils

apt update
apt install bridge-utils

Disable the HDMI pins (also audio, if you can), since they interfere with the connection quality. In order to do that, just uncomment the following line from /boot/uEnv.txt:

disable_uboot_overlay_video=1

Disable tether (enabled by default) so we can use the Wifi interface without further problems, also to save a bit on CPU usage and improve connection quality. Change the following line in /etc/default/bb-wl18xx from: TETHER\_ENABLED=yes to TETHER\_ENABLED=no

Configure network interfaces

Append the following lines to /etc/network/interfaces:

allow-hotplug wlan0
iface wlan0 inet manual
allow-hotplug eth0
iface eth0 inet manual
iface br0 inet static
bridge_ports wlan0 eth0
address 10.0.X.X
network 10.0.X.X
netmask 255.255.255.0
broadcast 10.0.X.255

Swapping out X with your own network’s parameters. All we’re doing here is bridging eth0 and wlan0 under the br0 bridge, which we’ll use later. You can also bridge other interfaces, just remember to swap them out.

Configure hostapd

Create a new file in /etc/hostapd/hostapd.conf with the following contents:

interface=wlan0
bridge=br0
driver=nl80211
country_code=BR
ssid=beaglehotspot
hw_mode=g
channel=1
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
auth_algs=1
macaddr_acl=0

Remember to change your password, country code and SSID. If necessary, swap out the driver as well, but nl80211 will suffice for the Beagle’s default hardware/peripheral configuration.

If you don’t want a password, omit all lines starting with WPA. However, that is unsafe and not recommended.

Point the daemon to the new configuration file

In order for the hostapd daemon to know where to look for our configuration file, change the following line in /etc/default/hostapd from:

DAEMON\_CONF="" to DAEMON\_CONF="/etc/hostapd/hostapd.conf"

Now we should be all set to enable the service.

Enable the service and restart

In order to enable the hostapd service, just run the following command as sudo:

systemctl enable hostapd

If it churns out an error mentioning that the service is masked, unmask it first:

systemctl unmask hostapd

Since the Beaglebone comes by default with dnsmasq and a DHCP server, we don’t have to worry about these for now, unless you want to change some settings.

Result

That’ll create a Wifi hotspot that works reasonably well, with minimum latency overheads. IPs will be assigned based on the eth0 interface’s network, so if that is not what you want, change your DHCP settings.