Internet Video Series, Part 2
Episode 18, Segment 02 of 06
When your computer wants to send an IP packet to another, it must examine the
destination IP address and make a decision as to whether the recipient can be
found on your - LOCAL - network. This is done by comparing the destination IP
address with the IP addresses of any and all network interfaces inside the
originating computer. If the addresses are similar, then the associated -
"Netmask" - value is used to determine the size of the local network(s) and
finalize the - "Local or Remote" - decision.
If the destination is - outside - of your local network, then the packet can be given to the router that serves as your network's - Default Gateway - and the routers within the worldwide Internet assume responsibility for delivery. To begin this process, your local computer encapsulates the outgoing IP packet inside an Ethernet frame, retrieves necessary Ethernet addressing information from your operating system's carefully managed, pre-existing notes, and uses it's Ethernet Interface to send the IP packet to the Ethernet address of your local router, which routes it to the Internet through your Internet Service Provider.
On the other hand, if the destination is - inside - your local network, then the outgoing IP packet is encapsulated inside an Ethernet packet that is addressed directly to the Ethernet interface of the intended recipient. (To understand the example shown here, it's important to remember that popular, low-cost NAT routers include an Ethernet Hub or Switch. In this case, that Ethernet logic - packaged inside the NAT router - relays the Ethernet frame directly to the Ethernet destination without using layer-3 routing at all).
In either case, just knowing the destination - IP - address is not enough for your operating system. Your computer will need to learn the local - Ethernet - Address to which it should forward the Ethernet frame for the short hop to the next step.