Connecting to databases through VPN

lampvpn

We want to create a web application using the usual LAMP stack. However, the app needs to also fetch data from a remote database, and that database can only be connected to if you are inside a VPN.

In the usual scenario, I run a VPN on my desktop, and then any program on my desktop can connect to the remote database.

But I don't know how to make my web server connect to a VPN. The web server has to simultaneously stay available on the open internet as well. If t hat is possible, then our web server app can fetch data from the remote database through the VPN, while service clients on the open web (and using its own local database for additional storage).

(If the answer implies that the web server needs two IP addresses, or even two NICs, that is no problem).

Thanks!

Best Answer

One server - vpn client, one - server. Mysql will listen on private vpn ip. Another server connects to this ip.

You dont need second ip or nic for that.

It is also possible with ssh tunneling only(Mysql listen localhost). Maybe this is not best variant.

Related Topic