Can I add a static route to a VPN network if the default gateway IP is dynamic? (Windows 7)
I've found out the answer myself:
You don't actually need to specify the default gateway - you can use the catch-all of 0.0.0.0 and then specify the interface number instead (the docs do not make this obvious!):
Find the interface number of the VPN by running "route print" from the command prompt and use this for the IF argument in the command below.
Add a static route for the IP range concerned using "route add" (with -p to make it permanent):
route add x.x.x.x mask 255.255.255.0 0.0.0.0 IF yy -p
Of course - you need to replace the IP address (x.x.x.x) and interface number (yy) in the command above with those relevant to your system.
Thankfully the VPN interface ID doesn't seem to change when you reconnect but it will be different from computer to computer.
"route print" should then show the desired static route with the gateway address as "On-link":
===========================================================================
Persistent Routes:
Network Address Netmask Gateway Address Metric
10.0.0.0 255.255.255.0 On-link 1
===========================================================================