Network between 2 instances of OpenVPN

There are some reasons when you have two or more instances on one server.
Assume that:

Task is allow ping between and .

Add routes

On we need to add route to network via IP

Knowing this OS will forward packets with IP 10.8.0.ххх to, so they will go to server and appear on tun1.

1st way to make it manually, e.g. if Client 2 run Windows:

route -p add mask

Same Same thig with Client 1, e.g. if it run Linux:

route add -net netmask gw

This is not cool way because it needs performing manual actions on clients and after reboot changes will be lost.

2nd and correct way is use automatic routes configuring with push "route х.х.х.х mask" option.

For network openvpn config we need to add:

push "route"

In this case, when Client 2 will connect to OpenVPN it will automaticaly do things that we performed manually. Add same line but with route to another config.

IP Forward in sysctl

Add (or uncomment) next to /etc/sysctl.conf


and reload it:

sysctl --system


The last thing change iptables on server:

iptables -A FORWARD -i tun1 -o tun0 -s -d -j ACCEPT
iptables -A FORWARD -i tun0 -o tun1 -s -d -j ACCEPT

Also take care about persistent saving iptables settings.

#openvpn #iptables
menu 8
Ivan Borshchov profile picture
Nov 24, 2016
by Ivan Borshchov

Other by Ivan Borshchov