1

My question might be broad but I was watching a Youtube video and thus I want to ask the following:

Is it true that a gateway may change the source MAC address of some packets passing through it to another MAC address? If so, why and in what cases this occur?

Thank you.

  • Might I suggest this article series and this youtube video. – Eddie Oct 14 '16 at 0:08
1

A gateway (router) does not change the MAC addresses, it discards them. MAC addresses are layer-2 addresses. A router will strip and discard the layer-2 frame. It then performs a lookup on the layer-3 address on the packet, switches it to a new interface, and builds a new frame for the new interface network type.

Not all layer-2 protocols use MAC addresses, some use 48-bit MAC addresses, and some use 64-bit MAC addresses. The new frame will be for the network type of the new interface, and it may not have a MAC address at all. If it does, then the new source and destination MAC addresses will be for the new link, not the old link.

  • Thank you for the response. In this paper (page3, table I on the top), goo.gl/9eHqft , authors compare between legacy networks and SDN. They mention the fact that layer-3 changes source MAC. I don't know why! – Alli Oct 11 '16 at 16:09
  • Layer-3 deletes the source MAC address, since that is in layer-2 frame, when the the layer-2 frame is stripped off before layer-3 processing. It's not that layer-3 changes a MAC address, it's that layer-3 discards the MAC address as part of the layer-2 frame it discards. – Ron Maupin Oct 11 '16 at 16:11
3

An easy explanation would be like

"IP Address is End - to - End. Mac Address is Hop - to - Hop."

Your layer 2 details are valid and useful only in your network, so the gateway changes the mac address in the layer 2 header. The Layer 3 header or the IP header will have IP addresses(Source and Destination) which will not be changed unless NATing is involved.

Hope this will help our query

  • Thank you .. so If I have this path: Host1 --> SW1 <--> SW2 --> R1 <--> R2 <--> SW3 <--> Host2 – Alli Oct 11 '16 at 16:35
  • Thank you .. so If I have this path: Host1 <--> SW1 <--> SW2 <--> R1 <--> R2 <--> SW3 <--> Host2 , so Host1 and Host2 and End - to - End while SW1 to SW2 is Hop to Hop ,, is that right? – Alli Oct 11 '16 at 16:36
  • Yes it is. Even though your message passes through n number of routers enroute the source IP and destination IP would not change. But each router will change the source mac nd destination mac. But there is one case in which the IP address can change enroute. This happens due to NAT-ing(Network Address Translation), where the source private IP address will be mapped to a public IP (Source NAT) an at the destination the destination public IP address gets mapped to the destination private IP (Destination Nat). – Joel Thomas Oct 12 '16 at 10:05
  • Routers don't change the MAC addresses. For example, you have a router connected to an ethernet LAN, and it receives a frame with a MAC address. The router strips the frame, the routes the resulting packet to a PPP connection to an ISP router. PPP doesn't use MAC addresses, so the new frame doesn't have a MAC address at all. Where did the router change the MAC address? – Ron Maupin Oct 13 '16 at 15:31
  • As long as the routers are connected using Ethernet cables, then MAC address changes with each hop. But as you mentioned when the edge router that is connected to an ISP router then it is not using the Ethernet frame or the MAC addressing. Here it will use PPP (default) or HDLC (Cisco proprietary). (Will edit this post and add some more details later.) – Joel Thomas Oct 18 '16 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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