Interview Prep/Networking/IP Addressing, CIDR, Subnetting & Routing

How does a host decide whether a destination is local or remote?

IntermediateConceptIP Addressing, CIDR, Subnetting & Routing
Answer

It ANDs the destination IP with its own mask and compares to its own network. If they match, the destination is on-link and the host ARPs for it directly. If not, the host sends the frame to the default gateway's MAC address with the original destination IP intact.

The IP header stays end to end (apart from NAT); the Ethernet header is rebuilt at each hop.

All Networking questions Roadmap: Networking for DevOps

More on IP Addressing, CIDR, Subnetting & Routing