Layer 2 switch operation - Clarify for me

Answered Question
Jun 19th, 2007

PC1 192.168.10.120

PC2 192.168.10.130

PC1 wants to send a file to PC2

Both PC1 and PC2 are connected to the same switch. Both PCs are in same vlan.

Here is the process as I understand.

1. PC1 determines that PC2 is on same network.

2. PC1 sends arp for Mac Address of PC2.

3. Switch builds MAC Address table and adds PC1's Mac Address.

4. PC2 responds to the Arp Address with its MAc Address.

5. Switch builds MAC Address table and adds PC2's Mac Address.

6. PC1 now builds the FRAME with the destination MAC that it received from the arp request.

7. PC1 sends a unicast frame to PC2

Does PC1 send a frame with the packet encapsulated? meaning does it still contain IP Source and Destination?

Or is it a Frame with just the Data minus the IP Source and Dest?

I'm guessing that once it travels down the OSI model, it receives the IP info before the frame MAC's so it must keep it.

I have this problem too.
0 votes
Correct Answer by scottmac about 9 years 5 months ago

A minor change somewhere around #10:

When a layer 3 device receives a frame, it strips the frame (discards it) and passes the contents (the packet, complete with L3 addressing) up the stack.

Then the L3 destination (the "network address") is determined, the routing/forwarding decision is made and the packet is passed down the stack to the L2 process for re-encapsulation, the new frame will have a new SOURCE MAC address (the L3 device's egress interface) and a new DESTINATION MAC address (PC2 in this case).

In this case, PC2 is directly attached, so the L3 device must also ARP (if necessary) for the L3 host address/MAC. IF there was another intermediate hop, the L3 device doesn't even look at the host portion of the L3 address.

The L3 device won't mess with the L3 address, but it will do things like decrement the TTL, possibly change the QOS mapping ... mostly just flags.

Other than that, you have a pretty good handle on it.

Good Luck

Scott

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
balajitvk Tue, 06/19/2007 - 11:26

Yes, Still it will send the frame with the packet encapsulated.

As far as the PC1 is concerned, the frame is always encapsulated Layer3 Packet.

Rate if it does,

Rgs.

cisconoobie Tue, 06/19/2007 - 12:24

Excellent now Question 2 with layer 3 switch.

PC1 192.168.10.120

PC2 192.168.20.35

1. PC1 determines that PC2 is on another network reacble via the "Default gateway"

2. PC1 checks local arp cache or send arp request for MAC address of deafult gateway.

3. Switch builds mac table with PC1 Mac Address

4. Gateway replies with its MAC Address

5. PC1 builds frame Destination mac with Gateway's MAC Address.

6. PC1 sends unicast frame to Gateway(Router)

7. Router checks IP Packet in frame and does routing table lookup.

8. Router determines that IP Packet is destined for locally attached network.

9. Router checks arp cache or does an arp request for Destination Host's Mac Address.

10. ???? Router strips of the destination mac and replaces it with the mac address of the host.

11. Router Forwards the frame to host.

Am I correct here or does the router just forward the framw ithout modifying the frame?

Does the Packet ever get altered?

Correct Answer
scottmac Tue, 06/19/2007 - 15:55

A minor change somewhere around #10:

When a layer 3 device receives a frame, it strips the frame (discards it) and passes the contents (the packet, complete with L3 addressing) up the stack.

Then the L3 destination (the "network address") is determined, the routing/forwarding decision is made and the packet is passed down the stack to the L2 process for re-encapsulation, the new frame will have a new SOURCE MAC address (the L3 device's egress interface) and a new DESTINATION MAC address (PC2 in this case).

In this case, PC2 is directly attached, so the L3 device must also ARP (if necessary) for the L3 host address/MAC. IF there was another intermediate hop, the L3 device doesn't even look at the host portion of the L3 address.

The L3 device won't mess with the L3 address, but it will do things like decrement the TTL, possibly change the QOS mapping ... mostly just flags.

Other than that, you have a pretty good handle on it.

Good Luck

Scott

farellfolly Thu, 06/21/2007 - 14:01

I could tell more by saying that L3 address stays unchanged end to end, but L2 address is changed from hop to hop.

For example if PC1 wants to send packet to PC2, it places PC2 Ip address in the packet header but the MAC address of the next hop (of the path) in the frame header.

When the next hop, may be a default gateway (such as a router)receives the frame, it stripp off the frame, replaces the MAC address with the one of the next hop (may be the final destination PC2) and so on.

But (i think) it does never changes the L3 address of the destination. (May somebody corrects me if i am wrong).

mheusing Fri, 06/22/2007 - 04:58

Hi,

for completeness a minor remark: there is one exception where the L3 address of a transit packet is changed by a router: Network Address Translation - NAT.

Regards, Martin

Actions

This Discussion