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 and it is connected to a gateway The gateway is connected to another network through another interface 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

Is that correct?


On the gateway:

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

On the host (presumably in, from which you are trying to ping

ip route add via

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.