0

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

3
  • Did you enable IP forwarding? See e.g. ducea.com/2006/08/01/how-to-enable-ip-forwarding-in-linux
    – Bodo
    Commented Mar 14, 2023 at 15:16
  • Yes I did, in all the ways described in that link
    – underAlex
    Commented Mar 17, 2023 at 17:08
  • Please edit your question and add all requested information or clarification to the question. Copy&paste the command and output how you enabled IP forwarding or how you checked that it's enabled. Use a network sniffer like Wireshark or tcpdump on different interfaces and/or check firewall logs to find out what exactly happens with the unsuccessful connection attempts. Please add links to the "variety of guides" you followed and mention on which one your current configuration is based.
    – Bodo
    Commented Mar 20, 2023 at 12:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.