DietPi as WiFi router?

I purchased on AliExpress a ComFast CF-926AC (MT7612U chip with in-kernel 4.19+ drivers) and ComFast CF-953AX (MT7921AU chip with in-kernel 5.19+ drivers) for later upgrades. Based on my extensive research, these are excellent USB3 WiFi adapters to run under Debian, you don’t need to mess with firmware drivers. I will know for sure when I test them.

Right now Debian Bullseye runs on 5.15 kernel, soon to be upgraded to 5.19, hopefully next year:

$ uname -a
Linux atlas.lan 5.15.61-v8+ #1579 SMP PREEMPT Fri Aug 26 11:16:44 BST 2022 aarch64 GNU/Linux

I will report back the results in the beginning of November, when I receive the products. The idea is to use CF-926AC until the kernel is upgraded. Or I can end-up using both USB adapters on same Pi 4B, as built-in WiFi caps me at 100mbps.

Intereating that RaspAP option to be client and AP at the same time. I didn’t know this is possible. Of course speeds are limited for AP clients but quite a nice alternative to 2 WiFi adapters or even WiFi + Ethernet. Probably we can adapt this as DietPi WiFi Hotspot option as well :thinking:.

Would such a setup satisfy people or cause more frustration?

I think it will useful to add RaspAP to DietPi. There is one small conflict with Pihole, but this can be easily fixed. Because current RaspAP setup deletes the hole /var/www/html directory, if you have Pihole installed, it will wipe-out the soft links. Something to keep in mind.

already on our wish list DietPi-Software | RaspAP: WiFi access point web interface · Issue #2813 · MichaIng/DietPi · GitHub

I received today the ComFast CF-953AX WiFi6 adapter. In order to use it with an ethernet cable, I had to also purchase a 90 degrees (up) USB3 connector:

Unfortunately is not detected (yet) because I need a kernel 5.19+. I’ll update the thread when I get the second model. If anyone knows a way to update the kernel, please let me know, so I can test ahead the WiFi6 adapter.

Nope, there is no RPI kernel 5.19 available as of now GitHub - raspberrypi/rpi-firmware at next

Even the next branch is still on 5.15. I guess you need to wait on RPi developer to work on it.

Yeah, probably available on next Debian release.

See if there is Ndiswrapper
How to Install a Wireless Card in Linux Using Windows Drivers (howtogeek.com)
(https://ndiswrapper.sourceforge.net/wiki/index.php/Main_Page)

Also found this
COMFAST CF-953AX - chipset: mt7921au · Discussion #88 · morrownr/USB-WiFi · GitHub

I received the ComFast CF-926AC V2 adapter, it is larger and automatically detected by OS, no built-in Bluetooth:

# inxi -EN
Network:   Device-1: MediaTek MT7612U 802.11a/b/g/n/ac Wireless Adapter type: USB driver: mt76x2u
Bluetooth: Message: No Bluetooth data was found.

wlan1 shows DOWN on a clean installation:

3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e4:5f:01:a0:55:37 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.16/27 brd 192.168.2.31 scope global dynamic noprefixroute wlan0
       valid_lft 82721sec preferred_lft 71921sec
    inet6 fd40:63:9937:443b:2c87:3cfc:aec:6dce/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 1667sec preferred_lft 1667sec
    inet6 fe80::672:c823:8d6d:765/64 scope link
       valid_lft forever preferred_lft forever
11: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether e0:e1:a9:17:37:2f brd ff:ff:ff:ff:ff:ff

ComFast CF-953AX not detected by OS, with built-in Bluetooth:

# inxi -EN
Network:   Message: No ARM data found for this feature.
Bluetooth: Device-1: MediaTek Wireless_Device type: USB driver: btusb
           Report: ID: hci1 state: down init running address: 00:00:00:00:00:00
           Report-ID: hci0 state: up running bt-v: 3.0 address: E4:5F:01:A0:55:38


First thing is to learn how I can enable wlan1 in DietPi? I prefer to get instructions, since we are dealing with a customized Debian OS.

wlan1 would need to be configured manually. We don’t have a tool who could do that. But usually RaspAP should do that?

Alternative to RaspAP, once you setup wlan0 as Internet facing adapter, follow the WiFi Hotspot install steps in dietpi-software, tweaked for WiFi 4 and 5 (but 2.4 GHz):

apt install hostapd isc-dhcp-server iptables
systemctl unmask hostapd

# DHCP server settings
cat << '_EOF_' > /etc/dhcp/dhcpd.conf
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;

subnet 192.168.42.0 netmask 255.255.255.0 {
        range 192.168.42.10 192.168.42.50;
        option broadcast-address 192.168.42.255;
        option routers 192.168.42.1;
        option domain-name "local";
        option domain-name-servers 9.9.9.9, 149.112.112.112;
}
_EOF_
echo 'INTERFACESv4="wlan1"' > /etc/default/isc-dhcp-server

# Network interface
cat << '_EOF_' > /etc/network/interfaces.d/wlan1.conf
allow-hotplug wlan1
iface wlan1 inet static
address 192.168.42.1/24
wireless-power off

# iptables NAT rules
up iptables-restore < /etc/iptables.ipv4.nat
up ip6tables-restore < /etc/iptables.ipv6.nat
_EOF_
ip a add 192.168.42.1 dev wlan1

# hostapd
cat << '_EOF_' > /etc/hostapd/hostapd.conf
interface=wlan1
driver=nl80211
ssid=yourSSID
hw_mode=g
ieee80211n=1
ieee80211ac=1
wmm_enabled=1
channel=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=yourPassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
_EOF_
chmod 0600 /etc/hostapd/hostapd.conf
echo 'DAEMON_CONF="/etc/hostapd/hostapd.conf"' > /etc/default/hostapd

# iptables NAT rules
iptables -t nat -A POSTROUTING -s 192.168.42.0/24 -o wlan0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT
ip6tables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
ip6tables -A FORWARD -i wlan0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT
ip6tables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT

# Save iptables rules, applied via /etc/network/interfaces
iptables-save > /etc/iptables.ipv4.nat
ip6tables-save > /etc/iptables.ipv6.nat

ifup wlan1
systemctl restart hostapd isc-dhcp-server
2 Likes