cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Ask the Expert- SD-WAN

158
Views
0
Helpful
2
Replies
Highlighted
Beginner

Which parts of the Ethernet, IP and TCP header will be modified when a packet is forwarded by i) router ii) switch?

I would like to know the changes happen at each level and what does not change at each level. And is there a difference between a router forwarding and switch forwarding. 

Everyone's tags (3)
2 REPLIES 2
Beginner

Re: Which parts of the Ethernet, IP and TCP header will be modified when a packet is forwarded by i) router ii) switch?

Hi Dak,

Your question is very basic, but very important at the same time.

So, we have 2x situations to explain, both will be based the following scenario,

PC1  ----- SW1  ---- R1  ---- R2  ---- R3  ---- SW2 ---- PC08

PC2  ----- SW1

PC3  ----- SW1

 

So, this simple topology saying that 3x PCs connected to SW1, which this switch is connected to R1.
Then, R1 connected to R2, which again connected to R3. Finally, this R3 is connected to SW2 which has PC08 attached to.

 

Assuming
PC1 IP = 10.0.0.1/24

PC1 MAC = AAA

PC2 IP = 10.0.0.2/24

PC2 MAC = BBB

R1 IP = 10.0.0.10/24 (the gateway of the PCs)

R1 MAC = CCC

#################

PC8 IP = 80.0.0.8/24

PC1 MAC = AA88

R3 IP = 80.0.0.10/24 (the gateway of the PCs)

R3 MAC = CC33

So,

We will have to cases to study,

1- PC1 communicating with PC2 (Called Switched / or  Local Communication)

The packet/traffic goes out for PC1 will have this in the header,

SRC MAC : AAA

DST MAC : BBB

SRC IP :10.0.0.1

DST IP :10.0.0.2

TCP Header (as per the application or traffic type), and will never get changed at any stage.

So, since both source and destination are in the same network/subnet, so the switch will handle this traffic and do switching which is processing the headers by checking the DST MAC and decide which port to send the traffic out (without anything change in the header).

 

 

2- PC1 Communicating with PC08 (Called Routing / or Remote Communication)

The packet/traffic goes out for PC1 will have this in the header,

SRC MAC : AAA

DST MAC : CCC

SRC IP :10.0.0.1

DST IP :80.0.0.8

TCP Header (as per the application or traffic type), and will never get changed at any stage.

 

This time is different, the source and destination are in different network/subnet, so the PC decide to send this traffic to its gateway which is the router (bcz from PC perspective, the gateway is only device in the network who should know about the way/path to reach any unknown networks)

that's why you see that DST MAC includes the Mac of the gateway, by sending such packet with such header, the switch receives it and knows where to send it, out of the ports connected to the router (switch can't understand the IP header, only deals with MACs).

So far, no changes in the header at all. 

But, once the R receives the packet, it will consult its routing table and figure the path/route to network 80.0.0.0 which should be through R2.

Here you are, R1 change the SRC MAC R1-Mac and DST and R2-MAC, and keep the rest of the header as the same.

Then, R2 will do the same, change the SRC MAC to R2-MAC and DST MAC to R3-MAC...an d so on.

In conclusion, IP headers remains the same throughout the whole journey from source to destination, but the MAC addresses changes hop-by-hop.

 

**** Please rate this post as helpful if it helped you, and as a correct answer if it solved your problem. ****

 

 

Moaz Elzhrawey
Solutions Architect, CCIE 2x RS | DC, VCP 3x NV | DCV | DTM
+966 596822551
Beginner

Re: Which parts of the Ethernet, IP and TCP header will be modified when a packet is forwarded by i) router ii) switch?

Thank you so much Moaz! gave me a clear idea on the topic.
CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards