Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm adding the route IP_ADDRESS NETMASK net_gatewayto the OpenVPN config file (locally), so it's not being pushed by the server and it works perfectly fine.

However, when I remove the routing line from the configuration file and reconnect to the OpenVPN server, it stays in the routing tables (according to route PRINT (in cmd.exe) on Windows 7). Which means OpenVPN doesn't remove the previously generated route.

I'd like to know how to prevent this. I have added a sample configuration file below (which is not too special).

dev tap
proto tcp-client
resolv-retry infinite
ca ca.crt
verb 3
route net_gateway
share|improve this question

The Windows 7 client machine is most likely caching the IP entry in it's ARP table or routing table. This Microsoft article outlines some default ARP behavior on Windows 7, including what the default time an entry is retained for. To test this hypothesis, I would connect using OpenVPN, disconnect, then flush the ARP table, and/or flush the routing table as well and see if the route still persists. If it's immediately gone, see how long it takes Windows 7 to remove the route without the manual flush. If that is the case, then you'll have to find a way to modify the default lifetime of a route/arp entry either via OpenVPN or a Windows 7 parameter or flush the table on the client post OpenVPN disconnect.

share|improve this answer
As far as I could test, the route is persistant until the next reboot or when the network device is restarted (disable and re-enable). Currently I have found a solution (but it's in C#) so it's not relevant to my initial question. – Devator Sep 11 '13 at 9:52

Define re-connect? How are you reconnecting?

You are using persist-tun in your configuration, which means the tunnel device stays up during a standard reload. Since the interface never goes down, routes associated with it never go away.

share|improve this answer
Reconnect: killing openvpn.exe en starting a new instance. I've removed persist-tun from the configuration file but to no avail. – Devator Sep 11 '13 at 9:50
  1. You can set up DHCP server and push routes using it:
  2. Remove persist-tun and pushing IP to client in VPN server configuration file.

I have this setup in a company I take care about, works perfectly. Basic idea of this solution is that Windows will deconfigure VPN interface after disconnect and configure it again after successful connect. No need for administrator rights, no hidden agenda, it's just work. Compatibility? Everything besides MacOS.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.