1

I have set up 2 VPN servers in 2 different locations [ A:openvpn server(ubuntu) , B: PPTP Server-RouterOS Mikrotik ]

What I want to do is to make A route all client traffic tthrough the pptp tunnel established between A and B:

Client <=> Server A <=> Server B

OpenVPN clients subnet is: 20.30.0.0/24

Server B ppp0 ip is: 172.31.0.251

I do: ip route add 20.30.0.0/24 dev ppp0

when i run tcpdump -i ppp0 i see pockets so it seems connection between A and B works but the client have not internet access when connect to openvpn server

Hope someone can help me with this. Thank you

  • So the client connect to VPN A, and VPN A is connected to VPN B. Than you would like to route the client through VPN A to VPN B, and on VPN B the client will connect to the WAN ("internet")? – Cristian Matthias Ambæk May 24 '18 at 12:34

1 Answers1

1

If I understand correctly, you need to NAT the traffic on the Ubuntu server, also, if you didn't, you have to enable the IP forward.

Try this after connecting the VPN:

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -s 20.30.0.0/24 -o ppp0 -j MASQUERADE

As an additional note, take in to consideration that the network 20.30.0.0/24 is not supposed to be a private network. See https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces

Hope it helps.

Jorge Valentini
  • 563
  • 4
  • 11