Skip to content

Instantly share code, notes, and snippets.

@luckydonald
Last active March 15, 2021 15:39
Show Gist options
  • Save luckydonald/2b3d1368d28d6d503dd3 to your computer and use it in GitHub Desktop.
Save luckydonald/2b3d1368d28d6d503dd3 to your computer and use it in GitHub Desktop.
How I configure the Cubietruck to work as an WLAN bridge.

In this file I document the steps taken to get the onboard wifi chip of the Cubietruck (Cubieboard 3) up and running.

Add the wifi driver to the modules to load on startup.

sudo nano /etc/modules

Now add at the end of the file, if not already in the list:

bcmdhd

Get the some tools. hostapd will manage the wifi, wpasupplicant does the wpa2 crypto stuff.

sudo apt-get install hostapd iw
sudo apt-get install wireless-tools wpasupplicant

reference to second line (DE)

Edit the currently empty hostapd.conf file

sudo nano /etc/hostapd/hostapd.conf

Note: I need to translate the comments to english. reference (DE, PDF)

logger_syslog_level=2
ctrl_interface=/var/run/hostapd
ssid="Netzwerk"
channel=8

## Wireless Modus
# g = IEEE 802.11g, Default: IEEE 802.11b
hw_mode=g

## Maximale Anzahl an Clients
# Limit: 2007, man sollte aber realistisch bleiben...
max_num_sta=20

## MAC­basierte Authentifizierung
# 0 = akzeptieren, wenn nicht explicit abgelehnt (deny_mac_file)
# 1 = ablehnen, wenn nicht explicit erlaubt (accept_mac_file)
# 2 = RADIUS­Server verwenden, nach Durchsicht der obigen Listen
# Zum Sperren/Erlauben diese Dateien anlegen und bestücken:
# accept_mac_file=/etc/hostapd.accept
# deny_mac_file=/etc/hostapd.deny
macaddr_acl=0


## Authentifizierung
# 1 = Open System, 2= Shared Key ­­> WEP
# 3 = beides
auth_algs=1

## Wi­Fi Multimedia (WMM) Extensions
# 0=aus
# 1=ein
# Anmerkung:
# DLNA funktioniert auch wenn wmm deaktiviert
wmm_enabled=0

## WPA/WPA2
# 1 = WPA, 2 = WPA2, 3 = both
wpa=3

#???
preamble=1

# WLAN­Key (Pre­shared Key)
# Anmerkung:
# Sollte für eigenen AP geändert werden
wpa_passphrase=01234567890
# CHANGE THE PASSWORD!!!

# Pre­shared­Key Management
wpa_key_mgmt=WPA­PSK

# WPA2 Verschlüsselung anbieten
rsn_pairwise=CCMP

# WPA Verschlüsselung anbieten
wpa_pairwise=TKIP

## Gerät und Treiber
# wlan einbinden
interface=wlan0

# Bridge einbinden
bridge=br0

# SSID nicht "verheimlichen"
# 0 = sichtbar
# 1 = Sende leere SSID und ignoriere Anfragen die die SSID nicht enthalten
# 2 = Sende leere SSID, aber setze die Länge nicht auf 0, sondern genau auf die Länge der SSID,
# einige Clients brauchen das.
ignore_broadcast_ssid=0

## 802.11n Unterstützung
#  0 = deaktiviert
#  1 = aktiviert
ieee80211n=1

Append to the end of the Network interfaces configuration:

sudo nano /etc/network/interfaces
## Ethernet -> WLAN Bridge
# dhcp instead of static
auto br0
iface br0 inet dhcp
# address 192.168.178.4
# netmask 255.255.255.0
# broadcast 192.168.178.255
# gateway 192.168.178.2
# dns-nameservers 192.168.178.2
bridge_ports eth0 wlan0
bridge_fd 0
bridge_stp no
sudo apt-get install bridge-utils
@Thomas-Sparber
Copy link

Hi, thanks a lot for this information, it was very useful!
Just a few things:

in /etc/modules you need to add the parameter op_mode=2 to bcmdhd (see http://linux-sunxi.org/Cubietruck#Wifi)
Next, if you want to start hostapd as daemon, you need to configure /etc/default/hostapd accordingly

Regards
Thomas

@shell832
Copy link

shell832 commented Mar 14, 2021

Translated

logger_syslog_level = 2
ctrl_interface = / var / run / hostapd
ssid = "network"
channel = 8

## Wireless mode
# g = IEEE 802.11g, default: IEEE 802.11b
hw_mode = g

## Maximum number of clients
# Limit: 2007, but you should be realistic ...
max_num_sta = 20

## MAC based authentication
# 0 = accept, if not explicitly rejected (deny_mac_file)
# 1 = reject if not explicitly allowed (accept_mac_file)
# 2 = Use RADIUSServer after reviewing the lists above
# To block / allow these files create and populate:
# accept_mac_file = / etc / hostapd.accept
# deny_mac_file = / etc / hostapd.deny
macaddr_acl = 0


## authentication
# 1 = Open System, 2 = Shared Key> WEP
# 3 = both
auth_algs = 1

## WiFi Multimedia (WMM) extensions
# 0 = off
# 1 = a
# Annotation:
# DLNA works even if wmm is deactivated
wmm_enabled = 0

## WPA / WPA2
# 1 = WPA, 2 = WPA2, 3 = both
wpa = 3

# ???
preamble = 1

# WLANKey (preshared key)
# Annotation:
# Should be changed for your own AP
wpa_passphrase = 01234567890
# CHANGE THE PASSWORD !!!

# PresharedKey Management
wpa_key_mgmt = WPAPSK

# Offer WPA2 encryption
rsn_pairwise = CCMP

# Offer WPA encryption
wpa_pairwise = TKIP

## Device and driver
# include wlan
interface = wlan0

# Include bridge
bridge = br0

# Do not "hide" the SSID
# 0 = visible
# 1 = Send empty SSID and ignore requests that do not contain the SSID
# 2 = Send empty SSID, but do not set the length to 0, but exactly to the length of the SSID,
# some clients need this.
ignore_broadcast_ssid = 0

## 802.11n support
# 0 = deactivated
# 1 = activated
ieee80211n = 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment