openvpn.is
English
简体中文繁體中文EnglishРусскийفارسی

HomeGuidesInto the office

Into the office

Reach an office or home network with OpenVPN: push route, forwarding on the server, the return route or NAT, Windows firewall, and clashing networks.

The route

Computer outside10.9.0.2OpenVPN server10.9.0.1Device inside192.168.10.0/24A way in, and a way back
The gate stands inside the network and people outside come in through it

Tell clients where the network is

server.conf
push "route 192.168.10.0 255.255.255.0"

Turn on forwarding

On the server
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-ovpn.conf
sudo sysctl --system

The way back

A device inside gets a packet from 10.9.0.x and does not know where to reply. Choose one:

WayHowBenefit
Static routeOn the office router send 10.9.0.0/24 to the OpenVPN serverYou see real sources
NATRewrite the source on the serverThe router stays as it is
With NAT
sudo iptables -t nat -A POSTROUTING -s 10.9.0.0/24 -o eth0 -j MASQUERADE

Still nothing

  1. ping 10.9.0.1Fails: the tunnel
  2. ping the server's internal addressFails: the route was not pushed
  3. ping another device insideFails: forwarding or the way back
  4. Shares do not openWindows Firewall allows only its own network; add 10.9.0.0/24
One stretch at a time
My home is 192.168.10.x too?

Clashing networks go to the wrong place. In the long run change one of them to something less common.

And the office reaching devices at my home?

Add iroute for your certificate and a matching route on the server. That is called site-to-site.

Walk onAll traffic through the gate

Nearby gates

Signposts: OpenVPN LAN access, OpenVPN push route, OpenVPN office network