Using Windows 7 with Multiple Gateways (Routers) and DHCP

Early last year we implemented a second Internet connection on our network.  We wanted to make it as easy as possible to switch between the two if the primary connection went down.  We are on a Windows domain and use DHCP from one of our domain controllers so it was easy to implement the 003 Router scope option with the two gateways and it worked great!

According to RFC2131 and the DHCP Options and BOOTP Vendor Extensions;

The router option specifies a list of IP addresses for routers on the client’s subnet.  Routers SHOULD be listed in order of preference.

That last bit was the key for working in our situation.  Our Windows XP clients grabbed the multiple gateway addresses and modified the routing table like this:

Active Routes: 
Network Destination  Netmask       Gateway    Interface  Metric
          0.0.0.0    0.0.0.0    172.16.0.1  172.16.0.40      20
          0.0.0.0    0.0.0.0  172.16.0.220  172.16.0.40      20

Both entries have the metric of 20, which was dynamically assigned by windows based on the link speed, the first entry is the one that was used.

We recently began testing Windows 7 in our environment.  We are fairly happy with most of the new features, performance and the overall experience in the new OS.  One thing that, so far, has been a great improvement is the new network stack.  With Vista, there were several issues including problems with unexpected freezes while network requests are made and problems with notebooks when trying to close the lid.  In Windows 7 most of those issues seem to have went away.

One minor issue that we did run across seems to be a bug, in my opinion.  When our Windows 7 clients processed the same DHCP requests as our XP clients, the routing table looked like this:

Active Routes:
Network Destination  Netmask       Gateway    Interface  Metric
          0.0.0.0    0.0.0.0    172.16.0.1  172.16.0.40      30
          0.0.0.0    0.0.0.0  172.16.0.220  172.16.0.40      30

Very similar results, just slightly modified metric which I can only assume is due to an updated algorithm for calculating the dynamic metric.  The only problem is that the second entry was being used as the default gateway.  We verified this on multiple Windows 7 clients.  It seems like it goes against he “order of preference” bit of the RFC.

It took quite a while and a lot of research, but I found out that Microsoft implements a vendor specific extension, 003 Microsoft Default Router Metric Base option.  The documentation for this value reads:

This value is a specified router metric base to be used for all default gateway routes used at Windows 2000 DHCP-enabled client computers.

This value can be assigned as an integer cost metric ranging from 1 through 9,999. It is used in calculating the fastest, most reliable, and least expensive routes. If a value is not specified, a default of either one (1) or the currently set interface-specific metric is used.

This is not very specific and for a while I did not think it would apply different metrics, but rather the same metric to all of the values in the 003 Router option.  I decided to give it a try regardless of my doubts and it worked!  Now, my XP route table looks like this:

Active Routes:
Network Destination  Netmask       Gateway    Interface  Metric
          0.0.0.0    0.0.0.0    172.16.0.1  172.16.0.40       1
          0.0.0.0    0.0.0.0  172.16.0.220  172.16.0.40       2

And my Windows 7 route tables looks like this:

Active Routes:
Network Destination  Netmask       Gateway    Interface  Metric
          0.0.0.0    0.0.0.0    172.16.0.1  172.16.0.40      31
          0.0.0.0    0.0.0.0  172.16.0.220  172.16.0.40      32

It is still disappointing that the DHCP routing options seems to be broken in Windows 7 (IMHO), and I am sure there will be plenty of people having similar problems when they begin rolling out Windows 7 clients in their environments.  Hopefully this article will save someone a little time trying to configure their Windows 7 clients to use multiple gateways.

Advertisements

6 thoughts on “Using Windows 7 with Multiple Gateways (Routers) and DHCP

  1. Thanks! I’d pretty much figured this out (in a vague sort of way) before I found your post, but you confirmed my suspicions and gave me a real explanation. Seems to me if MS is going to change things in such a fundamental way they should at least flash up a dialog on a new install mentioning the fact when Win7 first discovers multiple routes from the DHCP server.

    I described my little adventure here:
    http://www.techbog.com/node/5

    This is a new site we are trying to get off the ground to track just this sort of thing. It’s rather plain and empty for now, but hopefully that will change over time.

    /// DrFoo

    • Some sort of warning about the multiple gateways would be nice. Maybe the MS gang thought that people should have already been using the default metric or something so they didn’t bother, hard to say.

  2. Hi, I tried to setup 2 gateway on my network for redundancy.. I use 2 routing-switch as gateway and their default gateway to go outside is a Watchguard Firewall. The firewalls have botch switchs as route back to the each vlan with different metric.. Do you think I need RIP routing because the firewall doesn’t seems to know where to send back the traffic..
    thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s