Saturday 22 June 2013

LAN Switch Forwarding Logic


When I just started learning networking, getting my mind around the switching logic was one of the hardest tasks for me. I sort of understood how it worked but whenever I saw a question with mac address tables and interface numbers and I was then supposed to predict the path that the frame would take, I just went blank.

As it turned out, it actually wasn't half as hard as I thought it was. And I'll try to explain the forwarding logic as clearly as possible here.

First let me distinguish "forwarding logic" from "processing logic". Processing logic means how will the switch process the frame. Will it wait to receive the whole frame before it starts forwarding it (store-and-forward), will it start forwarding the frame after it has received a portion of the frame (fragment-free) or will it start forwarding the frame immediately upon receipt? This is a question of how the switch will process the frame. Forwarding logic asks: will the switch "forward" the frame, "flood" the frame, or "filter" the frame?

Forward means send the frame out a specific interface, flood means send the frame out all interfaces (except the interface that the frame came in on) and filter means will not forward or flood the frame.

Here's how it works:

When a switch receives a frame it checks its mac address table to see if it knows the destination device's mac address and what interface (port) has a path to that device. If it sees the device in its mac table then it will forward the frame directly to that device out the corresponding port. 

So a frame destined for device with mac address 0000.aa67.64c5 will be "forwarded" out interface Fa0/14 only and not any other interface. It could be said that the frame is "filtered" from going out any other interface.


If the device was not listed in the mac table the frame would be "flooded" out all interfaces (except the one it came in on) in hopes that it will reach the correct host. If the host receives the frame and responds, the switch will have learnt the devices mac address and will add it to the table.

All devices are within VLAN 1, but imagine now that the device with mac address 0000.aa67.64c5 is in VLAN 2. Then the switch will only forward frames that originate in VLAN 2 to that device. 

If Inter-VLAN routing is configured, the switch will forward any frame destined for that device but originating in a different VLAN to the default-gateway (router) on that network and the router will move the frame over to VLAN 2 so that the switch now sees it as originating in VLAN 2 and so it can now forward the frame to the above mentioned device in VLAN 2.

I do hope this was helpful.


Roger.






No comments:

Post a Comment