enter image description here

Lets say host A wants to send a packet to host B through R1(interface 1 then 2) and R2 (interface 3), so my questions is:

When the packet is forwarded inside R1 (from interface 1 to interface 2), ready to be sent to R2, does the pack's source MAC(A's MAC address) and destination MAC(interface 1's MAC address) get changed to interface 2's MAC address as new source address and interface 3(of R2) as new destination MAC address? If they do get changed, why router need to change source and destination MAC address?

  • It may help to frame this question in terms of the data payload traveling up and down the layer stack, with headers added or removed at each step. Sep 20, 2018 at 4:05
  • Changed the title to resolve the ambiguity, as at first it sounded to me like the routers change their own MAC addresses. I hope it reflects the intended meaning of the question. Sep 20, 2018 at 6:52
  • Short answer: there's no MAC address in a packet, so it can't change...
    – Zac67
    Dec 2, 2021 at 11:34

5 Answers 5


isn't a router only deal with IP address

A router with Ethernet (or Ethernet-like) interfaces needs to deal with MAC addresses because it needs to send and receive IP packets over those Ethernet interfaces and MAC addresses are a core part of Ethernet.

MAC addresses only have meaning within an Ethernet network.

Logically what happens at R1 is.

  1. The destination MAC address is checked. For a Unicast MAC address* if it doesn't match the frame is dropped by the network card, if it does match the Ethernet frame is stripped and the packet is passed up to the IP stack. This check is important to prevent packet duplication.
  2. The IP address is examined and determined to not be one of the local interfaces of the router.
  3. The IP address is looked up in the routing table and an interface and next-hop IP address is chosen.
  4. What happens next depends on the nature of the connection between R1 and R2. If the connection is Ethernet then the IP packet will be encapsulated in an Ethernet frame with the router's interface as source MAC and a MAC address looked up using the next-hop IP address as destination MAC address. On the other hand if the link is a serial point to point interface then there may be no MAC addresses involved at all and other protocols may have their own addressing scheme.

* Broadcast and multicast packets need more special handling, but that is outside the scope of this question.

  • do those MAC address do get changed?
    – amjad
    Sep 19, 2018 at 14:42
  • Will expand my answer, it's not so much a case of "changed" as "re-generated" Sep 19, 2018 at 14:46
  • 1
    The routing table contains an IP address for the next hop, the router looks up that address in it's arp table for the interface to find the destination MAC address. If there is no arp table entry the packets will be set aside while the arp process takes place to find one. Sep 19, 2018 at 23:30
  • 1
    MAC addresses are part of Ethernet, if the link is a serial point to point link then there will not be any MAC addresses in packets passing that link. Sep 20, 2018 at 0:14
  • 2
    Think of the Ethernet frame as being a truck/van (Ethernet) carrying your parcel (IP packet) from depot to depot (router). The MAC address is the depot address. Not all transports use trucks. There are planes, bicycles, pneumatic tubes etc (ATM, infiniband, PPP etc). Not all of them use MAC addresses (a plane might use Lang/Long, a pneumatic tube is point to point so don't use addressing etc).
    – Aron
    Sep 20, 2018 at 1:50

When a frame comes into a router, the router strips off and discards the frame, losing any layer-2 addressing, including MAC addresses. The router will build a new frame for the next interface.

Not all layer-2 protocols use MAC addresses, and of those that do, some are 48-bit MAC addresses, and some are 64-bit MAC addresses. It is the IEEE LAN protocols that use MAC addressing, but, for example, frame relay uses DLCI number, or ATM uses VPI/VCI. Point-to-point protocols may not use any addressing because there is only one other device on the link.

If the next router interface also uses MAC addresses, the router will build a new frame with the MAC address of its interface as the source address, and the MAC address of the destination on the link as the destination MAC address. If the next interface doesn't use MAC addressing, the router builds a frame for the protocol on the interface.

  • So how does a router know next router's MAC address? Isn't that routing algorithm just update each routers IP address forwarding table?
    – amjad
    Sep 19, 2018 at 23:06
  • A router is just another host on a link at layer-2, and it uses ARP just like any other host. For interfaces that use IEEE protocols (the ones that use MAC addresses), a router will maintain ARP tables, and it will send ARP requests for hosts connected to that interface for which it has no ARP table entry, the same way that your PC does.
    – Ron Maupin
    Sep 19, 2018 at 23:13
  • 1
    @amjad, your drawing isn't clear on the protocol used between the routers. It may be frame relay, or it may be PPP or some other protocol. In the case of such a non-IEEE protocol, there would be no MAC addresses on the router interfaces, and no ARP or MAC addresses on the frames, which would use frame headers and addressing (or not) for the protocol on the interface..
    – Ron Maupin
    Sep 19, 2018 at 23:17
  • @amjad, in any case, the frame, including any layer-2 addresses, would be stripped off the layer-3 packet as it enters the router, losing any of the layer-2 addresses that were on the frame, then the packet is switched to the next interface, and a new frame for the new interface is built.
    – Ron Maupin
    Sep 19, 2018 at 23:20

It's only rewording what others have already said, but the way I usually explain this is with a thought experiment:

  • Suppose there's no ethernet, and all of the hosts and routers have a direct point-to-point links (with the same connectivity, ie A to R1)
  • Many point to point links have no link addressing: just send the packet in some kind of framing and the other end receives it.
  • Then, exactly as you imagine, packets just have fixed IP source and destination address from host A to host B.
  • If it's convenient, a given set of links might be replaced by ethernet
  • To pass a packet in ethernet, it must have ethernet source and destination addresses in order to get to just the right node on the ethernet
  • On ethernet the frame says "I have this for you", where "I" and "you" are defined by the source and destination ethernet addresses
  • As the IP packet goes from hop to hop, different routers are saying "I have this for you", so of course the frame would have different source and destination addresses
  • If it's not ethernet, you get the appropriate kind of MAC addressing for that medium; 48-bit, 64-bit, none.

Simple answer, layer 2 addresses don't cross layer 3 boundaries. ARP only works on the local subnet/vlan. Host B will only see the MAC address in the frame for router 3's local interface.


Routers don't change the detination MAC address, they entirely drop the old L2 header and create a new one. When a frame comes to a router it examines the destination MAC address of the frame and only if it matches the MAC address of the ingress interface a L2 header termination takes place (only if this is a L3 interface, for L2 the behavior is different). If there is no match, the frame is dropped.

Next, a routing lookup takes place in a VRF table associated with the ingress L3 interface. The result of that lookup is a FEC that should have the following info:

  • Egress interface (after resolving the route recursively and have it in FIB)

  • Source MAC address (taken from egress interface)

  • Destination MAC address (learned by ARP)

With that information a new L2 header is constructed, and the frame is transmitted out of the resolved egress interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.