0

I have a remote VPS running OpenVPN server at some ip (my.vps.host.ip). Also I have Raspberry Pi router (RaspPI) running OpenVPN client that routes all traffic connected to it via wlan0 to that OpenVPN server. The problem is: from any device connected to Raspbery Pi router via wlan0, I can ping any valid IP address except my.vps.host.ip. Thus, I can't connect to the VPS using ssh.

Kernel IP routing table (RaspPI)
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.8.0.1        128.0.0.0       UG    0      0        0 tun0
0.0.0.0         192.168.31.1    0.0.0.0         UG    0      0        0 eth0
10.8.0.0        0.0.0.0         255.255.255.0   U     0      0        0 tun0
128.0.0.0       10.8.0.1        128.0.0.0       UG    0      0        0 tun0
my.vps.host.ip  192.168.31.1    255.255.255.255 UGH   0      0        0 eth0
192.168.17.0    0.0.0.0         255.255.255.0   U     0      0        0 wlan0
192.168.31.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

Tracing route from device connected via VPN gives the following:

traceroute to my.vps.host.ip, 64 hops max
  1   192.168.17.1  0,859ms  0,928ms  0,845ms 
  2   *  *  *

From RaspPI itself my.vps.host.ip can be pinged. The firewalls on both RaspPI and VPS are disabled. How can I make my.vps.host.ip accessible for VPN clients?

0

The cause of the above problem is still unknown to me, but a workaround was found: routing all traffic from wlan0 to my.vps.host.ip and vice versa directly via eth0 gateway. Following lines added to iptables solved the problem:

sudo iptables -I FORWARD -i wlan0 -o eth0 -d my.vps.host.ip -j ACCEPT
sudo iptables -I FORWARD -i eth0 -o wlan0 -s my.vps.host.ip -j ACCEPT
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.