Hello,
I have an OpenVPN server 2.3.4 on a Debian 8.6. The OpenVPN server has a few client and most of the client have its own subnet that has to be available through the tunnel.
The VPN server is on 192.168.254.1, the local subnet is 192.168.1.0/24
I put one 'route' line per each wanted subnet into server.conf and every client has a corresponding 'iroute' line in the client-config.
If I start the OpenVPN server it adds a few of the defined routes. A few, not all. Each time I restart the OpenVPN server the routes are changing. Some of them remains in the routing table (re-added), some of the are missing. With a very rare constellation or humidity the OpenVPN server is able the add all routes (after 3-5-7 restarts) and everything is working without config change ... for one day. Then the whole procedure starts from the beginning.
How could I debug the OpenVPN's route adding function? It is clear from the log that sometimes OpenVPN simply fails to add a route.
The client's subnet defined in server.conf:
route 172.24.16.0 255.255.252.0
route 172.25.16.0 255.255.252.0
route 192.168.2.0 255.255.255.0
route 192.168.3.0 255.255.255.0
route 192.168.4.0 255.255.255.0
route 192.168.19.0 255.255.255.0
route 192.168.20.0 255.255.255.0
route 192.168.40.0 255.255.255.0
route 192.168.41.0 255.255.255.0
route 192.168.55.0 255.255.255.0
route 192.168.56.0 255.255.255.0
route 192.168.100.0 255.255.255.0
route 192.168.250.0 255.255.255.0
route 192.168.251.0 255.255.255.0
route 192.168.253.0 255.255.255.0
I tried 'max-routes' with value 200, the result was worse. Then I tried with value 50, the result was a bit better, but not perfect.
I made a workaround with a script started with the 'up' setting, but I think the OpenVPN should do the route adding.
I included all wanted '/sbin/ip route add' line in the script to be sure the all routes are there. The last start of the OpenVPN produced this:
Sun Oct 9 20:11:37 2016 /sbin/ip route add 172.24.16.0/22 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 172.25.16.0/22 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.2.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.3.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.4.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.19.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.20.0/24 via 192.168.254.2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.40.0/24 via 192.168.254.2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.41.0/24 via 192.168.254.2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.55.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.56.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.100.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.250.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.251.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.253.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Sun Oct 9 20:11:37 2016 /sbin/ip route add 192.168.254.0/24 via 192.168.254.2
RTNETLINK answers: File exists
Sun Oct 9 20:11:37 2016 ERROR: Linux route add command failed: external program exited with error status: 2
Those line with
bold means that those commands were succeeded. The succeed of those commands means that OpenVPN hasn't succeeded adding those routes.
So ... why OpenVPN fails randomly adding routes?
Any help appreciated.
Regards,
Csaba