1

I have configured a network map in Virtual Box. I have one VM that acts as a host on a network. I want this host to access a private network that is located behind a gateway, through a tunnel. The private network prefix is 10.0.20.0/24 and it is connected to a gateway 10.0.20.1. The gateway is connected to another network through another interface 192.168.20.5. The VPN server will be installed on the gateway. I have created a tunnel and assigned it an IP address on the gateway, then I did the same on the host thus connecting to the server.

I get that the client is connected to the server and the server to the client.

The problem is that I can not ping from the outside host to the private network.

I think the problem is my routing table. On the external host, I set default gateway as the tunnel interface. And on the gateway, I add the net where the provate network is and set the gateway as 10.0.20.1

Is that correct?

2

On the gateway:

sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING --destination 10.0.20.0/24 -j MASQUERADE

On the host (presumably in 192.168.20.0/xx), from which you are trying to ping 10.0.20.0/24:

ip route add 10.0.20.0/24 via 192.168.20.5

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.