Page 1 of 1

Connecting 2 VPNs

Posted: Fri May 15, 2015 10:09 pm
by eLBati
Hello,

I have an openVPN server, with IP 192.168.170.1 (tap0), and my local PC, with IP 192.168.170.3 (tap0)

The server is also a client of another VPN and has IP 192.168.180.2.
The server's interfaces:

Code: Select all

tap0      Link encap:Ethernet  HWaddr 8e:03:2e:02:96:85  
          inet addr:192.168.170.1  Bcast:192.168.170.255  Mask:255.255.255.0
          [...]

tap1      Link encap:Ethernet  HWaddr 6e:6c:c5:f7:43:e2  
          inet addr:192.168.180.2  Bcast:192.168.180.255  Mask:255.255.255.0
          [...]
From server I can ping 192.168.180.* hosts, like 192.168.180.1

On my local PC, Kernel IP routing table contains

Code: Select all

Destination          Gateway         Genmask             Flags Metric Ref      Use Iface
[...]
192.168.180.0        192.168.170.1   255.255.255.0       UG    0      0        0    tap0
[...]
and I can ping 192.168.180.2 (my server's IP), but can't ping 192.168.180.1 (remote VPN host).

How can I reach 192.168.180.1 from my local PC?

Thanks

Re: Connecting 2 VPNs

Posted: Fri Jul 03, 2015 6:56 pm
by eLBati
I was missing the SNAT rule:

Code: Select all

iptables -t nat -A POSTROUTING -o tap1 -s 192.168.170.0/24 -j SNAT --to-source 192.168.180.2