Partager via


Default gateways

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Default gateways

Default gateways serve an important role in TCP/IP networking. They provide a default route for TCP/IP hosts to use when communicating with other hosts on remote networks.

The following illustration shows the role played by two default gateways (IP routers) for two networks: Network 1 and Network 2.

Role of default gateways

In order for Host A on Network 1 to communicate with Host B on Network 2, Host A first checks its routing table to see if a specific route to Host B exists. If there is no specific route to Host B, Host A forwards its TCP/IP traffic for Host B to its own default gateway, IP Router 1.

The same principle applies if Host B is sending to Host A. Without a specific route to Host A, Host B forwards any TCP/IP traffic destined for Host A to its own default gateway, IP Router 2.

Why gateways work

Default gateways are important to make IP routing work efficiently. In most cases, the router that acts as the default gateway for TCP/IP hosts--either a dedicated router or a computer that connects two or more network segments--maintains knowledge of other networks in the larger network and how to reach them.

TCP/IP hosts rely on default gateways for most of their communication needs with hosts on remote network segments. In this way, individual hosts are freed of the burden of having to maintain extensive and continuously updated knowledge about individual remote IP network segments. Only the router that acts as the default gateway needs to maintain this level of routing knowledge to reach other remote network segments in the larger internetwork.

If the default gateway fails, communication beyond the local network segment may be impaired. To prevent this, you can use the Advanced TCP/IP Settings dialog box (in Network Connections) for each connection to specify multiple default gateways. You can also use the route command to manually add routes to the routing table for heavily used hosts or networks.

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.

The automatic determination of the interface metric is enabled by default through the Automatic metric check box on the IP Settings tab on the advanced properties of the Internet Protocol (TCP/IP) protocol.

You can disable the automatic determination of the interface metric and type a new value for the interface metric.