Share server's VPN tunnel with other servers in the private network

I’ve got an interesting one. I have been unable to find a solution thus far. Either I’m going about this completely the wrong way, or the private networking DO offers has some restrictions.

ServerA has two ipsec/l2tp tunnels to external networks. It can access these networks fine, and when I access ServerA with OpenVPN, I can traverse these networks. ServerB in the same datacenter, shares a DO private network with ServerA, and they are both able to ping/ssh eachother.

What I’d like to do is be able to share ServerA’s tunneled networks with ServerB, instead of setting up additional VPN connections from ServerB to the external networks (which would mean more VPN connections as my VPS needs grow).

ServerA ppp0 routes to ppp1 routes to

ServerB if I attempt to ping to (for example), I’d like this to route/nat/what-have-you through ServerA.

I thought I could achieve this just by using the following route on ServerB ip route add via (ServerA's private network IP) or ip route add via (ServerA's private network IP) But I cannot get it to work. I’ve attempted a few things in iptables per what I could salvage through googled examples, but I don’t understand enough about iptables to know if I’m doing any of it right.

Any thoughts? Or do I give up and establish additional VPN tunnels for each VPS I need to spin up?

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


Just came across this question in late 2020. I could suggest using the new VPC networks instead: