4

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?

3 Answers3

9

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.

Maximus Minimus
  • 8,937
  • 1
  • 22
  • 36
4

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

JamesRyan
  • 8,138
  • 2
  • 24
  • 36
1

Have this issue when WiFi and Ethernet are connected at the same time. Ethernet is faster per previous post thus behavior is that the PC wants to send data thru Ethernet gateway by default and does not load balance or utilize both paths if one path does not lead to the internet.

I wanted to have WiFi access when configuring bench devices. So I went into TCP advanced settings on each adapter, un-check auto metric - set Ethernet to 15. Set WiFi to 1. The problem was gone. Just like OSPF metric for preferred path selection.

Overmind
  • 2,970
  • 2
  • 15
  • 24