We are going back to networking basics with this post. In few lines below you will find most important theory that makes network gear do its job.
The main router job is to making routing decisions to be able to route packets toward their destination. Sometimes that includes recursive lookup of routing table if the next-hop value is not available via connected interface.
Routing decision on end devices
Lets have a look at routing decision that happens if we presume that we have a PC connected on our Ethernet network.
If one device wants to send a packet to another device, it first needs to find an answer to these questions:
- Is maybe the destination IP address chunk of local subnet IP range?
- If that is true, packet will be forwarded to the neighbour device using Layer 2 in the ARP example below.
- If that is not the case, does the device network card configuration include a router address through which that destination can be reached? (default gateway)
- Device then looks at his local ARP table. Does it include a MAC address associated with the destination IP address?
- If the destination is not part of the local subnet, does the local ARP table contain the MAC address of the nearest router? (MAC address to IP address mapping of default gateway router)