I have a reoccuring routing problem with Windows 7 Enterprise 64: My LAN ethernet interface is connected to our company network (172.17.0.0/21)) that also offers the default gateway to the internet. The gateway also has routes to another private network within our company (192.168.1.0/24) that I can reach from my PC.
As I have to deal with many different devices on my desk that need to be configured over a web interface without being exposed to the company network. For that reason, I got me a small WiFi access point, disabled its DHCP server, and connected the device (the device is a UMTS router that needs to be configured) to its LAN port. The devices are always set to the address 192.168.1.1 by default, so I set my WiFi interface in Windows to the fixed address 192.168.1.100 and connected to the AP.
When the company network interface is disabled or unplugged, I can reach the device, otherwise I do not reach my device, but the host 192.168.1.1 in the aforementioned other company network via the default gateway. This behaviour is expected, as the default GW takes care and no explicit route to 192.168.1.0/24 exists yet. In order to fix this, I created a permanent route to the network 192.168.1.0/24 over my WLAN interface with a metric lower than the default route:
route add 192.168.1.0 mask 255.255.255.0 192.168.1.100 if 12 metric 5 -p
The default route has the metric 10, so I'm below that,
IF 12 is my WLAN interface,
-p for permanent route.
Right after setting this route in an admin cmd console, I can access the device and at the same time have internet access. I cannot access the other private company network 192.168.1.0/24, of cource, as the new route intercepts the packets - this is my desired behaviour.
Here's the core problem:
When I restart my machine, I can't reach the device anymore. When I look at the routing table, the route shown above still exists and gets listed in the routing table (as seen with
route print), but packets nevertheless go via the default route.
When I then delete the route by hand and then re-set it with the command from above, I instantly can reach the device again.
This is very annoying and unreliable. Why does Windows ignore my route in the first place? What can I do to fix the problem? I don't want to workaround with some batch scripts or similar, to be honest.