My home PC has a VPN connection to my office. The office network is firewalled, with a secure zone on 192.168.0.* and a DMZ on 10.0.0.*
From outside, www.mycompany.com routes to a public IP - say 18.104.22.168. Our firewall NATs that to 10.0.0.4. From within the office LAN, we use DNS records on our domain controllers to resolve www.mycompany.com straight to 10.0.0.4, because we can't route to the public interface of our own firewall.
When I connect the VPN from home, I get a 192.168.0.* IP assigned via DHCP, but because I'm not using the VPN as my default gateway, I can't route to 10.0.0.* addresses unless I manually add a route.
I've created a persistent route to pass traffic for the 10.0.0.* subnet via the default gateway on the secure firewall zone:
route add -p 10.0.0.0 mask 255.255.255.0 192.168.0.1
Here's the problem. When I reboot, the route still appears in the routing table - fine. If I then connect the VPN, the route appears, but doesn't work - I can't route to anything on the 10.0.0.0 subnet. BUT, if I remove and then re-add the route AFTER the VPN is connected, it works fine.
I have no idea why this is the case. The before/after configuration is IDENTICAL - same IP, same route table - but if I create route then connect, it fails; if I connect the VPN and then create the route, it succeeds.
Looking for any tips as to how I can either stabilize the configuration, or automatically create the route when the VPN connects?