BPI-R3 - Ubuntu 22.04 - Best way to create a wireless network

Hi, I would like to create a wireless network using my Banana Pi R3 router. The router runs the Ubuntu 22.04 OS provided by @frank-w.

I couldn’t find any guidelines on the official wiki on how to enable the wireless access point.

Here are the configurations for the interfaces:

userk@glutamate:~$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1504
        ether 2a:c7:61:35:65:58  txqueuelen 1000  (Ethernet)
        RX packets 2061  bytes 201582 (201.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1426  bytes 211923 (211.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 121  

he-ipv6: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1480
        sit  txqueuelen 1000  (IPv6-in-IPv4)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 2a:c7:61:35:65:58  txqueuelen 1000  (Ethernet)
        RX packets 1682  bytes 125420 (125.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1146  bytes 176369 (176.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 2a:c7:61:35:65:58  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 2a:c7:61:35:65:58  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lan3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 2a:c7:61:35:65:58  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lanbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.1  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::f437:88ff:fe50:d8bd  prefixlen 64  scopeid 0x20<link>
        ether f6:37:88:50:d8:bd  txqueuelen 1000  (Ethernet)
        RX packets 1681  bytes 125368 (125.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1142  bytes 175741 (175.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 66  bytes 7882 (7.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 66  bytes 7882 (7.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vlan500: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.50.19  netmask 255.255.255.0  broadcast 192.168.50.255
        inet6 fe80::f437:88ff:fe50:d8bd  prefixlen 64  scopeid 0x20<link>
        ether f6:37:88:50:d8:bd  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 24  bytes 2056 (2.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vlan600: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.60.19  netmask 255.255.255.0  broadcast 192.168.60.255
        inet6 fe80::f437:88ff:fe50:d8bd  prefixlen 64  scopeid 0x20<link>
        ether f6:37:88:50:d8:bd  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 23  bytes 1986 (1.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wan: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.6  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::28c7:61ff:fe35:6558  prefixlen 64  scopeid 0x20<link>
        ether 2a:c7:61:35:65:58  txqueuelen 1000  (Ethernet)
        RX packets 379  bytes 39064 (39.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 269  bytes 22950 (22.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wan.110: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.110.1  netmask 255.255.255.0  broadcast 192.168.110.255
        inet6 fe80::11:2ff:fe03:110  prefixlen 64  scopeid 0x20<link>
        ether 02:11:02:03:01:10  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 15  bytes 1306 (1.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wan.140: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.140.1  netmask 255.255.255.0  broadcast 192.168.140.255
        inet6 fe80::11:2ff:fe03:140  prefixlen 64  scopeid 0x20<link>
        ether 02:11:02:03:01:40  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 1376 (1.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Could you help me in the process? Thanks

Check here for some example config files for sustemd-networkd and hostapd:

Archlinux and Ubuntu for these files no difference.

The hostapd.conf files need some changes, as normally the variables cannot be expanded using bash. Comment the 802.11r part.

Thanks for your input @ericwoud.

I am now trying the following configuration file.

# hostapd configuration file

interface=vlan500
driver=nl80211
bridge=brlan
ctrl_interface=/var/run/hostapd
ssid=GemmaExt
country_code=EU
channel=1
hw_mode=g
ht_capab=[LDPC][HT20][HT40-][HT40+][GF][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1]
ieee80211n=1
auth_algs=1
wmm_enabled=1
#disassoc_low_ack=0
#ignore_broadcast_ssid=0
#ap_max_inactivity=30000

# WPA/IEEE 802.11i
wpa=2
wpa_passphrase=justsomepassword
wpa_key_mgmt=WPA-PSK FT-PSK
wpa_pairwise=CCMP

# 802.11r
#mobility_domain=$(echo $ssid | md5sum | cut -c1-4)
#mobility_domain=8c15
#nas_identifier=glutamate-vlan500
#ft_psk_generate_local=1
#ft_over_ds=1

# 802.11k
#rrm_neighbor_report=1
#rrm_beacon_report=1

I changed the interface from wlan0 to vlan500.

Tried commenting out the 802.11r part and when I launch the hostapd -d /etc/hostapd/vlan500.conf command I get the following error:

userk@glutamate:~$ hostapd -d /etc/hostapd/vlan500.conf 
random: getrandom() support available
Configuration file: /etc/hostapd/vlan500.conf
FT (IEEE 802.11r) requires nas_identifier to be configured as a 1..48 octet string
1 errors found in configuration file '/etc/hostapd/vlan500.conf'
Failed to set up interface with /etc/hostapd/vlan500.conf
hostapd_init: free iface 0x556d40da00
Failed to initialize interface

If I set the nas_identifier and execute the command again:

userk@glutamate:~$ hostapd -d /etc/hostapd/vlan500.conf 
random: getrandom() support available
Configuration file: /etc/hostapd/vlan500.conf
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=vlan500 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
netlink: Operstate: ifindex=14 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0x559254da00)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0x559254da00)
vlan500: interface state UNINITIALIZED->DISABLED
hostapd_bss_deinit: deinit bss vlan500
vlan500: AP-DISABLED 
hostapd_cleanup(hapd=0x559254f190 (vlan500))
vlan500: CTRL-EVENT-TERMINATING 
hostapd_free_hapd_data: Interface vlan500 wasn't started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) -> hapd_deinit
hostapd_interface_free(0x559254da00)
hostapd_interface_free: free hapd 0x559254f190
hostapd_cleanup_iface(0x559254da00)
hostapd_cleanup_iface_partial(0x559254da00)
hostapd_cleanup_iface: free iface=0x559254da00

The above output returns the nl80211 driver issue. How did you guys solve the problem?

Also remove FT-PSK …

vlan500 is not a wifi interface…

My image should create wlan0 (2g4) and wlan1 (5g). If these are missing try to load the mt7915e module. If there still no wifi interface you can look in dmesg for errors and if firmware is there in /lib/firmware/mediatek

@ericwoud Ok removed FT-PSK. Got the vlan500 wrong, changed it back to wlan0

@frank-w Thanks Frank! I loaded the kernel module using: sudo modprobe mt7915e Now wlan0 shows up in the output of ifconfig, I have added the mt7915e entry in the/etc/modules file and both wlan0 and wlan1 show up after a reboot.

I am now trying the following configuration file called hostapd_wlan0_gemma.conf.

# hostapd configuration file

interface=wlan0
driver=nl80211
bridge=brlan
ctrl_interface=/var/run/hostapd
ssid=GemmaNode
country_code=EU
channel=1
hw_mode=g
ht_capab=[LDPC][HT20][HT40-][HT40+][GF][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1]
ieee80211n=1
auth_algs=1
wmm_enabled=1

# WPA/IEEE 802.11i
wpa=2
wpa_passphrase=justsomepassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP

I launch it with: sudo hostapd -d /etc/hostapd/hostapd_wlan0_gemma.conf

I can see the wireless network but I cannot connect to it, do you have any advice?

What does your device and hostapd log say? Mostly a dhcp-server needs to run before devices show the connected status.

Afair my image should have systemd configured on wifi-interfaces. You should see ip on them too.

Have you antennas connected, board inside metal case? How far away to wifi client?

You can create an archlinux sd card within minutes and boot that. Choose router setup. It has a simple network setup, quite the same as you would need for Ubuntu. You could compare settings of systemd-network if you like the setup…

Logs were complaining about the bridge entry. So I removed the entry bridge=brlan and I can now connect to it.

I am trying to share the same network over all the LAN and WLAN0 interfaces and the first step was to connect to the wireless network. I asked a question on StackExchange and I think I got a stable solution.

I am missing 2 antennas, unfortunately… waiting for them to arrive. Hope not to damage the board. I am using a 3D printed case, half of it to be honest, and I am testing the connection from multiple distances. After a day of testing, the setup looks stable even at 20 m with a thick wall in between.

Hi @ericwoud I would love to test the approach. Honestly I really would like to be able to create custom Arch and Ubuntu OS images from scratch as you guys do.

Do you have any good references for me?

Follow the instructions.

For R3 it is quite new and the result may need some more testing, but it basically runs.

1 Like