for the past three days I have been trying to create a WiFi relay with my PiZero to then make into a Tor Router following a variety of guides online.
I am using the built-in wlan0 as the access point with hostapd and a USB WiFi dongle as the connection to the internet. I was able to set up the access point on wlan0 and connect wlan1 to my home router but, no matter what, I can't get any connection between any device connected to the wlan0's AP and the internet (not Tor, the normal internet). I could ssh to the Pi from a device connected to my house router and I could ssh to the Pi with a device connected to the AP (using the ip address set in /etc/network/interfaces file), so the two connection work fine on their own and my thoughts went to the iptables rules, thinking that I messed up something there, but after searching relentlessly I couldn't manage to figure out what is going wrong.
Output of route -n
rasp@raspberrypi:~ $ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.4.0 0.0.0.0 UG 302 0 0 wlan0
0.0.0.0 192.168.1.1 0.0.0.0 UG 303 0 0 wlan1
192.168.1.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan1
192.168.4.0 0.0.0.0 255.255.255.0 U 302 0 0 wlan0
Output of iptables -L
rasp@raspberrypi:~ $ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
/etc/iptables.ipv4.nat file
rasp@raspberrypi:~ $ sudo cat /etc/iptables.ipv4.nat
# Generated by iptables-save v1.8.7 on Mon Mar 13 18:23:20 2023
*filter
:INPUT ACCEPT [445:35806]
:FORWARD ACCEPT [3:156]
:OUTPUT ACCEPT [316:33101]
-A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i wlan0 -o wlan1 -j ACCEPT
-A FORWARD -i wlan0 -j ACCEPT
COMMIT
# Completed on Mon Mar 13 18:23:20 2023
# Generated by iptables-save v1.8.7 on Mon Mar 13 18:23:20 2023
*nat
:PREROUTING ACCEPT [83:12459]
:INPUT ACCEPT [7:1026]
:OUTPUT ACCEPT [29:2658]
:POSTROUTING ACCEPT [19:1827]
-A POSTROUTING -o wlan1 -j MASQUERADE
-A POSTROUTING -o wlan1 -j MASQUERADE
COMMIT
# Completed on Mon Mar 13 18:23:20 2023
/etc/network/interfaces file
rasp@raspberrypi:~ $ sudo cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source /etc/network/interfaces.d/*
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.4.1
netmask 255.255.255.0
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
I hope this is enough for someone better than me at this to figure it out, if you need any more information feel free to ask and I will update the post. Thank you