Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com May 3 '11 at 15:36

This question came from our site for professional and enthusiast programmers.

3 Answers 3

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.

share|improve this answer

I just ran into a similar (identical?) issue with a VPN routing problem. The VPN connection has the 192.168.152.0/22 subnet on the other side, so I added a persistent route with a low metric to hit that network. This route was consistently ignored. I solved the problem by added all 4 class C subnets as persistent routes, which did work as expected, even without ignoring default routes.

share|improve this answer
    
There 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. –  Chris S May 25 '12 at 2:41
    
The 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. –  Harper Shelby May 25 '12 at 18:32

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.