The problem encountered while performing local routing may be summarized as follows:
- How does host A know whether host B is in the same subnet?
- How does host A obtain the MAC address of host B?
- How does host A know that it can send the packet to router R so that the packet can reach host C that is in other subnet?
- How do hosts determine which router to use if two or more routers are connected to the same LAN?
For problem 1, because the source host knows its own subnet mask, it multiplies its own IP address by the subnet mask. It also multiplies the IP address of the destination host by-the same mask. If the two results are the same, the source host knows that the destination host is in the same subnet.
For problem 2, the ARP request packet that includes the IP address of the destination host is broadcast on the subnet. Then, the IP address and MAC address of the destination host, included in the ARP reply packet returned from the destination host are recorded on the table. Note, however, that contents of the table are deleted if they are not updated within a specified period of time. This is intended to accommodate changes made to MAC due to transfer of hosts or replacement of hardware.
Subnet mask refers to dividing an IP address into the network address and host address. For example, if 24 bits are assigned to the network address while 8 bits are assigned to the host address, then the subnet mask should be set to 255.255.255.0 (11111111111111111111111100000000).
Related Articles (You May Also Like)