Openvpn – RTNETLINK answers: File exists — OpenVPN errors

openvpnroute

I have a bunch of servers that connect to the world through a "gateway" server that uses a NAT to redirect to the internet.

I am trying to connect the gateway server to a VPN client through an OpenVPN config file. when I connect it returns an error "RTNETLINK answers: File exists". I don't have any firewall or port issues as a connection from an internal client using the same OpenVPN file works just fine.

here is my routing table prior to the VPN connection

192.168.110.0   *               255.255.255.224 U     0      0        0 eth1
10.149.0.0      *               255.255.0.0     U     0      0        0 ib0
link-local      *               255.255.0.0     U     1002   0        0 eth0
link-local      *               255.255.0.0     U     1003   0        0 eth1
link-local      *               255.255.0.0     U     1004   0        0 ib0
10.141.0.0      *               255.255.0.0     U     0      0        0 eth0
default         192.168.110.1   0.0.0.0         UG    0      0        0 eth1

here is the routing table after the connection is established and it blurts the error out:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
24.248.180.0    10.2.113.1      255.255.255.240 UG    0      0        0 tun0
192.168.110.0   *               255.255.255.224 U     0      0        0 eth1
10.2.113.0      *               255.255.255.0   U     0      0        0 tun0
10.0.0.0        10.2.113.1      255.255.252.0   UG    0      0        0 tun0
10.149.0.0      *               255.255.0.0     U     0      0        0 ib0
link-local      *               255.255.0.0     U     1002   0        0 eth0
link-local      *               255.255.0.0     U     1003   0        0 eth1
link-local      *               255.255.0.0     U     1004   0        0 ib0
10.141.0.0      *               255.255.0.0     U     0      0        0 eth0
default         192.168.110.1   0.0.0.0         UG    0      0        0 eth1

I think the problem is in the second line but if i delete that I will loose my external connection to the server correct?

is there a way to have the OpenVPN connection work without manually having to modify the route table. Or, is there a way to modify the route table to not have this error occur and have OpenVPN do its job?

Best Answer

You won't be able to diagnose the error you are getting purely by looking at the route tables.

That particular error is almost always related to you trying to add a new route that is identical to a route that already exists on your system. If you bump up your OpenVPN logging you should see what route command is failing in your logs.

OpenVPN is slightly dumb about how it applies routes. It doesn't do any checks to see if a route is already configured. If a route is configured within the configuration or pushed by the server, your client will attempt to add the route, even if it already exists. So sometimes this 'error' can be treated as a warning. Depending on the specific route and how it is being applied to the system.