# Reverse VPN All The Things

DevFeed: [Reverse VPN All The Things](<https://devfeed.tech/articles/reverse-vpn-all-the-things-35189.md>)

Original publisher: [Read original article](<https://blog.jessfraz.com/post/reverse-vpn-for-all-the-things/>)

Published: 2015-10-02T18:47:47Z

Content type: tutorial

Language: en

Sources: [Jessie Frazelle](<https://devfeed.tech/sources/jessie-frazelle.md>)

Topics: [Virtual Private Network](<https://devfeed.tech/topics/vpn.md>), [Docker](<https://devfeed.tech/topics/docker.md>), [synology nas](<https://devfeed.tech/topics/synology-nas.md>), [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>)

Tags: [docker](<https://devfeed.tech/tags/docker.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [network](<https://devfeed.tech/tags/network.md>), [server](<https://devfeed.tech/tags/server.md>), [synology](<https://devfeed.tech/tags/synology.md>), [synology-nas](<https://devfeed.tech/tags/synology-nas.md>), [vpn](<https://devfeed.tech/tags/vpn.md>)

## AI overview

A tutorial on using a reverse VPN to securely expose selected services from a home network to the public. It demonstrates setting up an OpenVPN server in Docker on a remote Google Cloud machine and connecting a Synology NAS as a client, then routing selected containers such as nginx through the VPN.

## Source excerpt

Usually when you think of a VPN, you think of accessing an office network from somewhere outside the office. A reverse VPN is for exposing things from your home network into the public. Why? Well for one, you shouldn't want to expose your home network to the world. There are a lot of risks in doing that. A reverse VPN allows you to securely control what you are exposing. Personally I use this for hooks that Amazon Lamda hits to interact with my Alexa. I use this awesome project to get Alexa to talk to my Sonos speakers. This runs in a docker container on my Synology NAS in my apartment. I also use a reverse VPN for my plex, blah blah, blah it's super handy okay. Let's set one up. On the Remote Machine I like to use kylemanna's openvpn docker image. I have this on my private docker registry at r.j3ss.co/openvpn-server. This image is publicly accessible and signed, etc. First, we are going to run commands on our remote machine. I just spun up a micro instance on Google Cloud. You can host it where ever you like though just make sure you have docker installed there. 1) Generate the config, we are saving all the state into /volumes/openvpn but you can store it wherever. ```sh # substitude your own domain for rvpn.j3ss.co below $ docker run --rm -it \ -v /volumes/openvpn:/etc/openvpn \ r.j3ss.co/openvpn-server \ ovpn_genconfig -u udp://rvpn.j3ss.co:1194 ``` 2) Generate certificates: ```sh # This will prompt you for a passphrase and the information for your # certificate request. $ docker run --rm -it \ -v /volumes/openvpn:/etc/openvpn \ r.j3ss.co/openvpn-server \ ovpn_initpki ``` **NOTE**: If you need help with entropy you can download something over and over again: `while true; do sleep 1; curl 'https://misc.j3ss.co/gifs/iptables.gif' > /dev/null; done` 3) Start the openvpn server: ```sh $ docker run --restart always -d \ --name openvpn \ -v /volumes/openvpn:/etc/openvpn \ --net host \ --cap-add=NET_ADMIN \ r.j3ss.co/openvpn-server ``` 4) Create a client certificate, my