How I run two openvpn server in same private network

I am running two openvpn servers in private network ( Only in case one server stops working.


default gateway internet router:
openvpn1:, debian, bananapi m2
openvpn2: old= new=, debian, bananapi B2
web server1: (static ip), also running unbound dns and dnsmasq as DHCP server, debian
web server2: (static ip), enigma2


First, both openvp servers where configured the same, using for the remote clients. Do not forget to enable ip4 forwarding: sudo sysctl -w net.ipv4.ip_forward=1.

Unfortunately, some hosts did not respond, when connected to the second openvp server. Don’t know, why openvpn server1 works for remote connections connecting to private web servers. Internet browsing using default router worked with both opvpn connections.

When running a ssh session on .137 or .143, I was able to ping .40, but could not browse to the .40 web server from the remote connection. When connected to openvpn2, I could not open the web page of the server.

How does a host know to use correct vpn network for sending back traffic and do not use the default router?


I changed the configuration to openvpn2 to use Then I tested with static routes on

For the static ip (/etc/network/interfaces):

  post-up route add -net gw dev eth1
  post-up route add -net gw dev eth1

After that temporary change on .40, I was able to to connect to openvpn2 and the web server on .40.

For dhcp clients in network (many esp8266, esp32 and esplink devices), I need to have an option for DHCP too.

On the dnsmasq dhcp server:


Note that the default router option (dhcp-option=option:router, may be ignored by dhcp clients

The dhcp options have been verified on a debian client:

aoa150:~$ ip r
default via dev wlan2 proto static metric 600 via dev wlan2 proto dhcp metric 600 via dev wlan2 proto dhcp metric 600 dev wlan2 proto kernel scope link src metric 600

Now I can connect from my mobile using OpenVPN to my network using openvpn1 and openvpn2 server.

Leave a Reply