0
Is there a way to print out the gateway for a specific route (not interface) in Windows (in this case Win7)? I'd need to add a route dynamically in an OpenVPN _up script, but since the gateway is dynamically assigned when the connection is formed, I can't script it statically.
There also appears to potentially be some environment variables (route_vpn_gateway?) available for the _up scripts, but I haven't managed to get them to work.
I suppose I gan use awk/grep from GnuWin tools and parse the 'routes' output, but perhaps there is a cleaner/easier way?
This works (using GnuWin32 utilities), but is [really] ugly :D
routes | grep -P "192\.168\.1\.0\s+255\.255\.255\.0\s+(\d+\.\d+\.\d+\.\d+)" | awk "{print $3}"
(The VPN connection in question pushes a route to 192.168.1.0/24 address space.)
Perhaps someone has a more elegant solution to my question.. :)
Using the above grep/awk I came up with this. It works, but like I said, it's awfully ugly and I'm almost certain there's a neater way – probably by accessing data available for the _up script. Anyone? Anyone?
– Ville – 2013-01-10T03:48:26.040