Workstations--To
gateway or not to gateway First it ANDs the destination address of the packet with its own subnet mask. If the resulting address matches its own network mask, then the destination is in the same subnet, and the TCP/IP stack tells the card to send the packet directly to the destination machine. (Actually, more than this occurs in order to send the packet directly, but it's no longer part of TCP/IP, but Ethernet. This is covered in Section 2.2.) If, however, the calculation shows that the destination is part of another network, then the sender makes use of its gateway to transmit the packet. In effect, the sender is saying, "I do not know how to deliver this packet; can you please deliver it for me?" The gateway accepts the packet and then goes through a similar procedure. (That procedure is known as routing, and there will be plenty more about it later.) Table 2.4: Address Information for Workstation Routing Examples Here are a few examples of the workstation's decision-making process (the workstation IP and network information is in Table 2.4): Workstation A sends to workstation B: Are A and B in the same subnet?
they are equal--both 192.168.16.0 Because the network address of the sender matches the result of this calculation, the packet is sent directly to machine B. Workstation C sends to workstation B: Are C and B in the same subnet?
they are not equal--192.168.17.0 does not =192.168.30.0 In this case, the comparison fails. The sender, C, has no choice but to send the packet to its gateway. (If you take the time to do the calculation, you discover the gateway is in machine C's subnet. In fact the gateway must always be in the sender's subnet; otherwise, the sender could not send to it either!) |