So there are 4 fields I'm considering. Source/destination of each the MAC address and the IP address.

If the datagram is going through a few hosts, which of these values will be changing. From what I understand, both of the destination addresses do not change, but one of the sources do change.

As each of the hosts process the data packet, I think they change only one of these values, and I think it's the source MAC address. Is that true?

  • 1
    This video will shed some light on your question. Also suggest reading the entire article series discussing how a packet moves through a network.
    – Eddie
    Apr 20, 2016 at 22:12
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Aug 7, 2017 at 21:20

3 Answers 3


Ideally, the source and destination IP addresses don't change. In practice, NAT may be used, and, depending on the NAT used, either the source, destination, or both IP addresses may be changed.

In a LAN, source and destination MAC addresses do not change; they are specific to the LAN on which the frame originated. You may be confused by the fact that a layer-3 device (e.g. a router) will strip off the frame, which contains the source and destination MAC addresses. If the layer-3 device sends the packet out a different interface, it will create a new frame, based on the new LAN, to which it is sending the packet. In this case, the new frame will have different source and destination MAC addresses.


It depends what devices the communication passes through.

Lets consider a network. A real network will have more hops but this shows all the important elements. All connections in the network we are considering are ethernet.

Client<-->Ethernet switch<-->NAT<-->IP router<-->server

Now lets say the client goes to set up a TCP connection to the server.

The client builds a packet. It's source MAC is set to it's own MAC address. It's destination MAC is set to the MAC of the relavent port on the NAT box. It's source IP is set to the clients private IP. It's destination IP is set to the IP of the server. It's source port is set to the port the client is bound to (which is usually selected randomly). It's destination port is set to the port for the desired service on the server.

The Ethernet switch simply passes the frame on. It doesn't change any addresses.

The NAT strips off the Ethernet headers. It then modifies the IP headers changes the source IP address to it's public IP. It may also change the source port to disambiguate connections from different clients. The destination IP and port remain unchanged. A mapping table entry is created so that reverse translation can be performed. New Ethernet headers are then built with the source MAC being the MAC of the relavent port on the NAT box and the destination MAC being the MAC of the relavent port on the IP router.

The IP router strips off the Ethernet headers and again builds new ones so the packet can be sent to the server.

The packet arrives at the server, a reply is generated and a similar process proceeds to get the packet back to the client.


If the packet goes through switches, nothing is changed. If the packet goes through a router, the Source MAC address is changed hop by hop (A hop is a layer 3 device)

  • If a packet goes through a router, you may, or may not, get a new MAC address. Many layer-2 protocols don't use MAC addresses. For instance if you connect via ethernet with a MAC address on the frame, and the link on the other side of the router is PPP, the frame is stripped from the packet, and PPP doesn't use MAC addresses, so the frame coming out the other side will not have a MAC address.
    – Ron Maupin
    Sep 7, 2016 at 17:35
  • Well said, I'm accustomed to think only in Ethernet term, so I stand corrected. Nov 17, 2016 at 22:42

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.