-1

I was wondering whats the best way to do a static route for all ips except a predefined set.

For example, I have 2 networks attached to one workstation. I want all ips except 192.168.0.0/24 to go through network A and all other through network B. I know I can set a static route to A for those ips, and set the network B priority higher than network A, but in case network A cant find an ip it might try to look for it on network B, and I want to avoid that.

The workstations are all win 7 pro.

Any help would be greatly appreciated. Thanks in advance!

TechnIckS
  • 109
  • 4

2 Answers2

0

Workstation routing tables are not like DNS server preferences: the most specific entries will be consistently used unless metric comes into play. (if both interfaces had the same network configured, the one with the preferred metric would win) There is no failover to other routes if a host is unreachable. Were this not the case, traffic from your local networks could potentially leak out through a default gateway, which clearly isn't something that anyone who values their network security would want.

I recommend refreshing yourself on networking concepts, as this is considered to be the very basics of how a routing table works. Please don't take this personally, I'm recommending it strictly for your own benefit.

Andrew B
  • 32,588
  • 12
  • 93
  • 131
0

Thanks for all the answers.

I figured it out: (Network A gateway is 192.168.0.1, network B gateway is 10.0.1.1)

route delete 0.0.0.0 mask 0.0.0.0 192.168.0.1
route add 0.0.0.0 mask 0.0.0.0 10.0.1.1
route add 192.168.0.0 mask 255.255.255.0 192.168.0.1

First line deletes the main route from network A Second line adds network B as main route Third line adds all 192.168.0.* to network A I made this a login script and it did the trick!

It works like a charm! :)

TechnIckS
  • 109
  • 4
  • If you are having to do this with a login script on statically configured interfaces, you are doing something wrong. The routes should be configured within the interface properties. If the interfaces are dynamically configured via DHCP, you did not mention that rather pertinent detail. – Andrew B Feb 05 '13 at 10:04