How Routers Traverse Packets to Their Destination

arpethernetipmac address

Sorry in advance for such a noob set of questions.

I understand that when set with the task of sending a packet to its destination, a computer first checks that the IP address of the destination is on the same network by its mask and IP address. I know that when a computer needs the MAC address, it broadcasts an ARP requests to all nodes on that broadcast domain.

How does this work for external networks? For example, let's say that I want to navigate to https://google.com, and my browser goes through with all the DNS queries and fetches the IP Address. I am guessing because of Ethernet, my computer sends an IP packet with the source as myself and the destination as Google's IP address, then wraps that in a layer 2 frame with the default gateway as the destination MAC. Does the router/default gateway strip the layer 2 frame and send that up to its default gateway over PPPoA (this is my situation), or does it then replace that frame with its own source MAC and the destination MAC as its default gateway?

Having trouble finding answers and would really love some help.

Best Answer

Your understanding is pretty close.

When a router receives a frame, it does strip off the frame to get to the packet. The router then looks in its routing table to see if it has a route to the destination address. If not, it drops the packet. If so (and a default route works as a last resort), the router switches the packet to its interface of the next hop.

That hop may, or may not, have a protocol which uses MAC addresses (not all do, PPP doesn't use MAC addresses). In any case, the router builds a new frame, encapsulating the packet for the next hop, and it forwards the new frame out the next hop interface.