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.

My windows machine has two network cards, both have default gateways. How does windows determine which gateway should it access when sending a packet to a remote endpoint?

More precisely, here's my routing table:

    Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0         10.0.0.1      10.0.0.191       10
          0.0.0.0          0.0.0.0    192.168.1.254    192.168.1.38       20
         10.0.0.0    255.255.255.0       10.0.0.191      10.0.0.191       10
       10.0.0.191  255.255.255.255        127.0.0.1       127.0.0.1       10
   10.255.255.255  255.255.255.255       10.0.0.191      10.0.0.191       10
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
      192.168.1.0    255.255.255.0     192.168.1.38    192.168.1.38       20
     192.168.1.38  255.255.255.255        127.0.0.1       127.0.0.1       20
    192.168.1.255  255.255.255.255     192.168.1.38    192.168.1.38       20
        224.0.0.0        240.0.0.0       10.0.0.191      10.0.0.191       10
        224.0.0.0        240.0.0.0     192.168.1.38    192.168.1.38       20
  255.255.255.255  255.255.255.255       10.0.0.191      10.0.0.191       1
  255.255.255.255  255.255.255.255     192.168.1.38    192.168.1.38       1
Default Gateway:     192.168.1.254

When I send a ping to 10.0.0.180 it sends an arp through the network card associated with 10.0.0.191, while when I ping www.google.com it goes through 192.168.1.254. How does it decide?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Your ping to 10.0.0.180 goes out to 10.0.0.191 based on the 3rd rule

share|improve this answer
    
Damn, I missed it. –  rouli Aug 27 '09 at 9:40

Have a look at this:

Using multiple gateways

If you have multiple interfaces and you configure a default gateway for each interface, TCP/IP by default automatically calculates an interface metric that is based on the speed of the interface. The interface metric becomes the metric of the default route in the routing table for the configured default gateway. The interface with the highest speed has the lowest metric for its default route. The result is that whenever multiple default gateways are configured on multiple interfaces, the fastest interface will be used to forward traffic to its default gateway.

If multiple interfaces of the same speed have the same lowest interface metric, then, based upon the binding order, the default gateway of the first network adapter is used. The default gateway for the second network adapter is used when the first is unavailable.

In previous versions of TCP/IP, multiple default gateways all had a default route metric set to 1, and the default gateway used depended on the order of the interfaces. This sometimes caused difficulty in determining which default gateway the TCP/IP protocol was using.

share|improve this answer

Your Answer

 
discard

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