Gab_
Posts: 2
Joined: Fri May 17, 2019 1:24 pm

VPN Router setup problem

Fri May 17, 2019 1:44 pm

Hello everyone!
If this problem was already discussed- sorry. But I wasn't able to find solution to my problem.

The thing is- I am trying to create VPN router with my Raspberry. I am using model 3 B+ with Raspbian Strech Lite.
Raspberry is connected with my actuall router with ethernet cable and I want it to broadcast wifi.

I've started with setting up hotspot settings

Code: Select all

git clone https://github.com/unixabg/RPI-Wireless-Hotspot.git
cd RPI-Wireless-Hotspot
sudo ./install

With this step I had problem with: "failed to start dhcpcd on all interfaces" error
I've solved it with

Code: Select all

dpkg -l | grep dhcp
apt-get remove dhcpcd5

and with: "Failed to start hostapd.service: Unit hostapd.service is masked."
I've managed to solve it with this one:

Code: Select all

sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd

At this point I am able to connect with internet through Raspberry Pi hotspot.

Next step was setting up the VPN. I set everything up with this instruction:
https://nordvpn.com/pl/tutorials/raspberry-pi/openvpn/

After that I've added DNSs and IP in

Code: Select all

sudo nano /etc/dhcpcd.conf

And now my acutuall problem
I am able to browse internet through Raspberry Pi router if VPN is disabled. I am not able to do it with VPN enabled. My mobile is able to connect to hotspot but does't have connection with internet.
But if I try either of those commands:

Code: Select all

 ping 8.8.8.8.
 speedtest-cli
 
through terminal I get information that the connection is actually estabilished.

Does anyone have any suggestions?
Thanks in advance!

User avatar
neilgl
Posts: 623
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: VPN Router setup problem

Fri May 17, 2019 8:19 pm

Ah that link is for 2014 (Raspbian Wheezy) so their scripts probably don’t work with Raspbian Stretch.
Maybe post a question in Nordvpn forum if it is a paid service you have?

Gab_
Posts: 2
Joined: Fri May 17, 2019 1:24 pm

Re: VPN Router setup problem

Sat May 18, 2019 2:30 pm

Thanks for answer Neilgl.
That was my first try when I've encountered this problem, but they werent able to help me instantly, so I've decided to ask here if anyone had similar problem and know the solution. Especially because the connection itself was made but wasn't working with hotspot.

Anyway, I've managed to solve the problem with with this guide: https://pimylifeup.com/raspberry-pi-vpn-access-point/
In general, I've forgot to take care of the routing (if that's what it's called) and I had to reroute wlan) through tunnel.

Everything was solved by those commands.

Code: Select all

sudo iptables -F
sudo iptables -t nat -F
sudo iptables -X
sudo iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
So in general, problem was solved and hotspot appears to be working now.

Return to “Troubleshooting”