WLAN Access Point with Realtek rtl8822bu Chipset on Linux


The system environment

tp-link AC1300 High Gain Wireless MU-MIMO USB Adapter Archer T4U Ver. 3.0 WLAN on openSuSE Leap 15.0 with kernel version 4.12.14. The Ver. 3 of the adapter is important as other versions have different chipset.

lsusb lists this device with ID 2357:0115

This kernel version does not include a driver for this wlan chip, so we have to build it ourselves.

Building driver module

The tp-link website offers the driver sources. At the time of this writing this is: Archer T4U_V3_181018_Linux_beta.zip.

Unpack the zip file to a place of your choice, enter the directory and issue a make clean && make && sudo make install

With every kernel update, the above process need to be done again.

Setup the WLAN network device

ip addr add 192.168.0.1/24 dev wlan0

The address asignment may be automated by adding a RUN command to the udev rule which sets up the device.
In my case this is in /etc/udev/rules.d/70-persistent-net.rules, I changed it to look like this:

# USB device 0x2357:0x0115 (usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="50:3e:aa:b6:fc:77", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0", RUN+="/sbin/ip addr add 192.168.0.1/24 dev '%k'"

Setup the hostapd daemon

The 88x2bu is a mac80211-based driver

Create a configuration file /etc/hostapd.conf, a minimal one looks like this:

interface=wlan0
driver=nl80211
debug=0
ssid=mars
# this is in Switzerland
country_code=CH

# use 5GHz channel
hw_mode=a
channel=44

own_ip_addr=127.0.0.1
wpa=2
# generate wpa psk by using
# wpa_passphrase [ ssid ] [ passphrase ]
#wpa_psk=<psk-key>
# or use 
wpa_passphrase=**censored**

Start hostapd:

systemctl start hostapd

DHCP server

Setup a DHCP server to assign ip addresses and the like to connecting clients.
My /etc/dhcpd.conf looks like this:

option domain-name "my.domain";
option domain-name-servers ns1.provider, ns2.provider;

default-lease-time 600;
max-lease-time 7200;
ddns-update-style none; ddns-updates off;
authoritative;
log-facility local7;

subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.2 192.168.0.254;
  option domain-name-servers ns1.provider, ns2.provider;
  option domain-name "";
  option routers 192.168.0.1;
  option broadcast-address 192.168.0.255;
  default-lease-time 600;
  max-lease-time 7200;
}

In /etc/sysconfig/dhcpd set the interface the dhcpd listens to:

DHCPD_INTERFACE="wlan0"

Start dhcpd:

systemctl start dhcpd

Firewall/Routing

Setup SuSEfirewall for routing between eth0 and wlan0.

Bringing all up on USB Adapter plugging in

to be written..

see systemd-networkd(8) to get an idea how this could be done.

Links to some interesting articles on this topic

line
linux logo Powered by Apache
line
This site maintained by:
lukas.zimmermann@unibas.ch
My public PGP key
last updated: 2019-03-12 Valid CSS! Valid XHTML 1.0 Strict