How to make routes on a windows 7 laptop persistent?
- by askvictor
I have a number of (windows 7) laptops that normally connect via wireless. We also have a wired network for special purposes. When one of these laptops plugs in to the wired network, at the moment, it makes the wired network the default route. Instead, I would like it to keep the wireless network the default, and route only 10...* through the wired. I can achieve this with:
route delete 0.0.0.0 IF 22
route add 10.0.0.0 ... IF 22
(where IF 22 is the wired network interface).
But how can I get this to stick? Currently, if the wired network is unplugged then re-plugged, it grabs the default route again. So I want a way of making the wireless network not get the default route, and to make the 10...* network persistent.
Is there a hook to run commands after a network connection is established in windows? In linux I would use post-up hooks.