Tor/VPN Router [How To Auto-Connect VPN After Tor Connected at Boot]

  • Dear Forum-Raspberry.de Family,


    Hope you are well and healthy. I could not decide on this Project on Going Project or Network and Server. But then i thought going projects is appropriate.


    My name is Enes and i am living in Istanbul. As you know in my country everything is being enforced by brute force to people. Tor, Wikipedia, Imgur, Pastebin, NorthVPN, ProtonVPN, Privateinternetacces, PureVPN, etc. many website and service is blocked. There is no "privacy" in my country. For this reason i am looking for a "full privacy solution" for me and who is living same fate since years. They are "full privacy solution". Today i encountered with a "Raspberry Pi VPN server project" and I liked it. I have one (RPI 3B) and I want to make a full-fledged solution with VPN and Gate (with obfs4). I have created a Gate router with RPI and it is working good (little bit slow but i do not have any choice). But i want to add more security and privacy to this router. I can not use it because it is heavily blocked. I want to do something but i could not find how can i make. Let me explain.


    My Onion AP is working for now and i connect as a client from a computer https://check.torproject.org website and everything is OK.


    My VPN membership supports TCP and UDP OpenVPN. It has TCP and UDP .ovpn files with a lots of country. I installed Open VPN on Raspberry and configured it for auto-connect at boot. It is working when I reboot Raspberry, it connects automatically. But i have a problem.


    This VPN is heavily blocked and can not use it. I tried ikev2, L2TP, Obfuscated Servers, Onion Servers, Double Servers and Standalone Servers of this VPN but there is no luck. Then I tried something. I connected Gate Router from computer and tried to connect this VPN firm. I could connect, it worked. Because i connected first Tor router and then VPN.

    My current schema is this:

    RPI ---> Internet comes from eth0 ---> Tor ----> Share Tor Connection by wlan0

    To Do:

    RPI ---> Internet comes from eth0 ---> First Connection Gate ( VPN with port, if i share immediately by iptables, there is no port connection i can not connect VPN) ---> Then connect VPN ---> Share Gateway / VPN internet by wlan0

    I searched on forums, blogs and websites lots of. OpenVPN is using tun0 interface. I have three (3) questions. I am stucked here.


    1) How can RPI connect VPN with Tor without forward port connection? (Connect VPN with Tor and then share Tor / VPN.

    2) When i get these steps how can I test Tor / VPN connection from a computer (client)? I mean how can i seperate them?

    3) Should I add these commands to iptables-ipv4.nat script?

    -A POSTROUTING -o tun0 -j MASQUERADE

    -A FORWARD -i tun0 -o wlan0 -m state -state RELATED, ESTABLISHED -j ACCEPT

    -A FORWARD -i wlan0 -o tun0 -j ACCEPT

    If i achieve this i want to be so happy and restful.


    Could you please help me about these issues?


    P.S: Sorry for my bad English.


    Thanks in advance.

    Best Regards,

    Enes