Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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).

client
dev tap
proto tcp-client
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
comp-lzo
verb 3
auth-user-pass
route 192.168.1.100 255.255.255.255 net_gateway
share|improve this question

2 Answers 2

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 http://support.microsoft.com/kb/949589, 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

Your Answer

 
discard

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.