Legal Information
PC Knowledge Base -TCP/IP Routing Tables Destination Host On Local Subnet

Good Knowledge Is Good2Use

Take a server (172.16.11.30) that has to send a packet to another host with IP address 172.16.11.80, which is on the same subnet. This packet will thus have source address 172.16.11.30 and destination address 172.16.11.80. Here is how Windows uses its routing table to decide which route to use.

  1. Windows first takes each route from the table in turn and performs a bitwise AND between the destination address in the packet (172.16.11.80) and the bitmask (Netmask) of the selected route. Here are the results, where each route in the table is identified by its network destination
  2. For each route, the result of this ANDing is then compared with the Network Destination field of the route, and a match means the route can be used to forward the packet to its destination address. If more than one match is found, Windows uses the route with the longest match (the route whose Netmask has the highest number of 1 bits).
    If this doesn't result in a unique match, Windows uses the match that has the lowest cost (Metric).
    Finally, if more than one match has the same lowest cost, Windows arbitrarily chooses one of them as the route to use. From the table above, you can see that this ANDing process results in two matches (routes 1 and 3) so Windows chooses the one that has the longest match, which is row 3.
    The result of all this is that Windows now knows which route to use to get this packet to its destination. Here's what this route looks like in the server's routing table:
  3. Windows now uses the following algorithm to decide what to do next:
    1. If the route's Gateway field matches the address of one of the network interfaces on the server (or if the Gateway is empty) then Windows sends the packet directly to its destination address using the interface specified in the route.
    2. If the route's Gateway field does not match the address of any of the network interfaces on the server, then Windows sends the packet to the address in the route's Gateway field.
Clearly, condition A is the case here since the route's Gateway field (172.16.11.30) is the address assigned to the server's single network card. Windows therefore determines that the destination address is on the local subnet and that means Windows can send the packet directly to that address without needing to forward it to any routers.
So in this case, Windows simply sends the packet to 172.16.11.80 using the server's 172.16.11.30 network interface, and the receiving host gets it.



Search Knowledge Base Feedback
If you like our web site refer a friend.
Your friends name.
Your friends email address.
Your Name
Your Email Address


© Copyright 1998-1999 GOOD2USE