Networking – Is the MAC address needed outside of the LAN

lannetworkingrouterroutingswitch

I am learning about MAC and IP addresses and why we need to have both of them and not just one. Say I have the following network:

enter image description here

Say PC 1 wants to send a packet to the Web Server. Now I understand that PC 1 needs to use two addresses for this task: the address of the Router (so that the Switch can pass the packet to the Router), and the address of the Web Server.

The MAC address will be used as the address of the Router, and the IP address will be used as the address of the Web Server.


My question is: is there a real use for the MAC address outside of the LAN, for example when a Router is passing a packet directly to another Router (like the two Routers I circled in yellow in the above image).

I understand the benefit in PC 1 putting the MAC address (I am talking about destination MAC address of course) in the packet of the Router when inside of the LAN as I have previously explained, but when a Router is passing a packet directly to another Router, where is the benefit in it putting the MAC address in the packet of the next Router?

Best Answer

MAC Addresses are used on layer 2 only, and Layer 2 is effectively a single Local Area Network with its own broadcast domains and link-local networks. The source MAC Address and target MAC address inside TCP/IP Packets is changed as they travel from network to network by routers which are forwarding the packets based on destination IP Address.

There is no usefulness of a PC's MAC address outside of its own local network, apart from potentially being able to use it to find the vendor of the network card for support purposes.

The reason the first router puts the target router's MAC address in the destination part of the header, is so that when it transmits it over the wire, the target router will know that the packet is destined for it, and will pick it up.

For more information, read the Wiki article on OSI Layer 2, known as the Data Link Layer