Skip to content

Instantly share code, notes, and snippets.

@adde88
Created April 23, 2025 13:04
Show Gist options
  • Save adde88/67aad280bf42c8f6c642ea39661bb1fc to your computer and use it in GitHub Desktop.
Save adde88/67aad280bf42c8f6c642ea39661bb1fc to your computer and use it in GitHub Desktop.
TP-Link Archer T4U. RTL8822BU driver. Monitor mode, injection, AP mode + optimizaiton for Raspberry Pi 3B+
# /etc/modprobe.d/88x2bu-profiles/88x2bu.ap.conf
#
# This config was written by Andreas Nilsen - @adde88 - https://www.github.com/adde88
# Date: 23. April 2025
#
blacklist rtw88_8822bu
options 88x2bu \
rtw_drv_log_level=3 # WARNINGS only :contentReference[oaicite:10]{index=10} \
rtw_led_ctrl=1 # LED normal blink :contentReference[oaicite:11]{index=11} \
rtw_vht_enable=1 # Enable 802.11ac without forcing 80 MHz :contentReference[oaicite:12]{index=12} \
rtw_power_mgnt=0 # Disable power saving for max TX power :contentReference[oaicite:13]{index=13} \
rtw_switch_usb_mode=0 # Keep USB2.0 on Pi :contentReference[oaicite:14]{index=14} \
rtw_wireless_mode=95 # Dual-band b/g/n & a/n/ac :contentReference[oaicite:15]{index=15} \
rtw_country_code=US # US FCC regulatory domain
# /etc/modprobe.d/88x2bu-profiles/88x2bu.monitor.conf
#
# This config was written by Andreas Nilsen - @adde88 - https://www.github.com/adde88
# Date: 23. April 2025
#
blacklist rtw88_8822bu
options 88x2bu \
rtw_drv_log_level=3 # WARNINGS only :contentReference[oaicite:10]{index=10} \
rtw_led_ctrl=1 # LED normal blink :contentReference[oaicite:11]{index=11} \
rtw_vht_enable=1 # Enable 802.11ac without forcing 80 MHz :contentReference[oaicite:12]{index=12} \
rtw_power_mgnt=0 # Disable power saving for max TX power :contentReference[oaicite:13]{index=13} \
rtw_switch_usb_mode=0 # Keep USB2.0 on Pi :contentReference[oaicite:14]{index=14} \
rtw_wireless_mode=95 # Dual-band b/g/n & a/n/ac :contentReference[oaicite:15]{index=15} \
rtw_country_code=US # US FCC regulatory domain

RTL88x2BU Optimizations for Raspberry Pi 3 B+

Author: Andreas Nilsen / @adde88
Date: April 23, 2025

This gist contains a small collection of two customized driver-options, as well as a helper script to switch between the two config files on a Raspberry Pi 3 B+.
Designed for Kali Linux (arm64) with Nexmon patches, specifically for the TP-Link Archer-T4U (RTL 8812AU).

One config file focuses on monitor mode and packet injections, with additional optimizations.
The second config file has more focus on acting as either a real or fake access-point, with full optimizations, and power improvements, to make sure it targets as many devices as physically possible.


πŸ“ Overview

  • Purpose:
    • Monitor/Injection profile: Enables dual-band monitor mode, full-power transmit (no power-save), warning-level logs, and standard USB2 mode.
    • AP/Fake-AP profile: Forces 80 MHz VHT for high throughput, SU beamformer, FCC DFS channels, and full-power transmit.
  • Why a Gist?
    • Easily shareable and updatable as a single bundle of files (not a full repo).

πŸ“‚ Folder Structure

β”œβ”€β”€ 88x2bu-profiles/
β”œβ”€β”€ 88x2bu-profiles/88x2bu.monitor.conf
β”œβ”€β”€ 88x2bu-profiles/88x2bu.ap.conf
β”œβ”€β”€ setup-rtl88x2bu
└── README.md

  • '88x2bu-profiles' directory holds the two config files, one focusing on monitor-mode and injection support, and one for AP mode with correct optimizatons for that mode, tring to reach as many client as physically possible, both also further optimized for the device and other usage.
  • setup-rtl88x2bu symlinks the chosen profile as /etc/modprobe.d/88x2bu.conf and reloads the driver.

πŸš€ Quick Start

  1. Clone or download this Gist to your Raspberry Pi 3B+, running Kali Linux 2025.1a. (My current linux version now as of today is 'Linux rpi3 6.6.74+rpt-rpi-v8' (with Nexmon patches)
  2. Move profiles into /etc/modprobe.d/88x2bu-profiles/ and the setup-script to: /usr/local/bin/setup-rtl88x2bu:
    mkdir ~/gits && cd ~/gits
    sudo git clone --recursive https://github.com/morrownr/88x2bu-20210702 && cd 88x2bu-20210702
    sudo mkdir -p /etc/modprobe.d/88x2bu-profiles
    sudo cp 88x2bu-profiles/*.conf /etc/modprobe.d/88x2bu-profiles/
    sudo cp setup-rtl88x2bu /usr/local/bin/
    sudo chmod +x /usr/local/bin/setup-rtl88x2bu
    

Usage:

sudo setup-rtl88x2bu monitor  # for monitor/injection mode    
sudo setup-rtl88x2bu ap       # for AP/fake-AP mode

More updates incoming..sooon.πŸ˜‰

#!/usr/bin/env bash
#
# Filename: /usr/local/bin/setup-rtl88x2bu (Remember to chmod +x the script saved before running it)
# This script was written by Andreas Nilsen - @adde88 - https://www.github.com/adde88
# Date: 23. April 2025
#
set -euo pipefail
PROF_DIR="/etc/modprobe.d/88x2bu-profiles"
ACTIVE="/etc/modprobe.d/88x2bu.conf"
usage(){
cat <<EOF
Usage: $(basename "$0") {monitor|ap}
monitor β†’ activate monitor/injection profile
ap β†’ activate AP/fake-AP profile
EOF
exit 1
}
[ $# -eq 1 ] || usage
case "$1" in
monitor) TARGET="88x2bu.monitor.conf" ;;
ap) TARGET="88x2bu.ap.conf" ;;
*) usage ;;
esac
echo "Switching 88x2bu β†’ $1 profile"
sudo ln -sf "$PROF_DIR/$TARGET" "$ACTIVE"
sudo depmod -a
sudo modprobe -r 88x2bu
sudo modprobe 88x2bu
echo "Done: $ACTIVE β†’ $TARGET"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment