Research

Wireless Access Point

Setting a wireless access point for the beaglebone black

It should be easy if we get the right usb dongle. So far we have tried 2 different realtek types and they fail miserable with the existing open kernel drivers. Not going to compile crap kernel modules and use hacked ancient versions of hostap, thanks

Our last purchase which is a “TP-Link TL-WN722N” should hopefully be an atheros chipset which we always had great experiences with.

Well the previous two we bought were supposed to be atheros but only until version 3. The ones we received where version 4…

If this works it will be great. It also has external antenna connection.

 ***UPDATE***
 And it does work out of the box ...



setup

Assuming that a bridge is setup already with the wired interface in it and something like dnsmasq is serving ip addresses all needed for it to work is:

1
aptitude install  hostapd  haveged firmware-atheros

Haveged is a daemon that helps providing entropy for our wpa ap.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  egrep -v '(^#|^\s*$)' /etc/hostapd/hostapd.conf
  interface=wlan0
  bridge=br0
  driver=nl80211
  ctrl_interface=/var/run/hostapd
  ssid=boat
  hw_mode=g
  channel=1
  wpa=2 # This sets the security settings to WPA2
  wpa_passphrase=hackme
  wpa_key_mgmt=WPA-PSK
  wpa_pairwise=TKIP
  rsn_pairwise=CCMP
  beacon_int=100 # This sets how often the WiFi will send a beacon out.
  auth_algs=3
  wmm_enabled=1

Start the services

1
2
service haveged start
service hostapd start

We also need a couple of iptables rules for NAT:

1
2
3
4
5
6
7
8
9
10
11
12
#!bin/bash
iptables -t nat -F
iptables -F
echo 1 > /proc/sys/net/ipv4/ip_forward
LAN='br0'
WAN='usb0'
iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
iptables -A FORWARD -i usb0 -o $LAN -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT

ip route del default
dhclient $WAN

The $WAN interface could be anything that the internet is plugged in. In our case a 4g usb dongle on usb0. We add this to /etc/rc.local before the exit 0 line at the end if it exists.

1
2
3
...
sh /root/bin//masq.sh
...
Standard