DietPi as WiFi router?

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