Windows Server 2008 Ignores Persistent Route With Lower Metric
Solution 1
I think if the 10.100.20.0/24 network is directly connected, the server is going to ignore the route table and just use that link regardless of the metric.
Solution 2
If the destination IP is on a directly connected network, Windows will never lookup potential routes.
It's that simple.
Related, some VPN software overrides this so the VPN will work when both the VPN and the local network have the same subnet.
Related videos on Youtube
![Rob Moir](https://i.stack.imgur.com/WmCYt.jpg?s=256&g=1)
Rob Moir
Updated on September 18, 2022Comments
-
Rob Moir almost 2 years
I have three Windows Web Server 2008 SP2 machines on a 10.100.20/24 subnet. I need to setup a persistent routing rule so that outgoing traffic to the same subnet goes through a hardware load balancing device.
In Server 2003 it is as simple as adding a persistent route using the command:
route add -p 10.100.20.0 mask 255.255.255.0 10.100.20.157
In server 2008 that same command does add a similar persistent route, but the system basically ignores it even though it has a lower metric than the default record.
Here is the Server 2008 output from
route print
:IPv4 Route Table Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.100.20.157 10.100.20.178 276 10.100.20.0 255.255.255.0 On-link 10.100.20.178 276 10.100.20.0 255.255.255.0 10.100.20.157 10.100.20.178 21 10.100.20.178 255.255.255.255 On-link 10.100.20.178 276 10.100.20.179 255.255.255.255 On-link 10.100.20.178 276 10.100.20.255 255.255.255.255 On-link 10.100.20.178 276 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 10.100.20.178 276 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 10.100.20.178 276 Persistent Routes: Network Address Netmask Gateway Address Metric 10.100.20.0 255.255.255.0 10.100.20.157 1 0.0.0.0 0.0.0.0 10.100.20.157 Default
To illustrate the problem, here is the output from a trace-route in Server 2008:
Tracing route to 10.100.20.1 over a maximum of 30 hops 1) <1 ms <1 ms <1 ms 10.100.20.1 Trace complete.
As you can see, the rule with the lower metric of 21 is ignored and the route goes directly to the machine on the 10.100.20/24 subnet. The routing should have gone through 10.100.20.157 before going on to 10.100.20.1. In Server 2003 this works correctly, but Server 2008 seems to ignore the rule with the lower metric. If I manually remove the default route so that my custom routing record is the only one for 10.100.20.0, then it is properly routed through the load balancing machine.
I've worked with Microsoft tech support and their proposed solution is to set the NIC to ignore all the default routing records and add every routing rule as a persistent route. I'm having trouble manually setting up all the rules to work properly, but I can work that out with Microsoft.
If there is a way to actually get Server 2008 to adhere to the metric rules, or script something to handle an event every time the TCP stack is initialized to remove the default route, or edit the registry to remove the default route when TCP initializes, any one of those solutions would be better in my opinion.
-
Philip about 12 yearsThere haven't been "classes" for 18 years. Additionally, your routes were probably ignored because they were less specific than existing routes. Metric is only used as a tie breaker for routes with the same network mask.
-
Harper Shelby about 12 yearsThe routes were not less specific than existing routes. They were significantly more specific, in fact. I empirically proved that routes added using "route add" were ignored after some period of time, but that routes added using netsh did, in fact persist.