Thursday, 31 August 2017

How L2 Switch works

Layer 2 switches (bridges) have a MAC address table that contains a MAC address and port number. Switches follow this simple algorithm for forwarding packets:
  1. When a frame is received, the switch compares the SOURCE MAC address to the MAC address table. If the SOURCE is unknown, the switch adds it to the table along with the port number the packet was received on. In this way, the switch learns the MAC address and port of every transmitting device.
  2. The switch then compares the DESTINATION MAC address with the table. If there is an entry, the switch forwards the frame out the associated port. If there is no entry, the switch sends the packet out all its ports, except the port that the frame was received on (Flooding).
Note that the switch does not learn the destination MAC until it receives a frame from that device.

(Host A) <--> (Switch A) <--> (Switch B) <-->(Host B).
Also important to note, a L2 Switch forwards, it does not route. By that I mean, when it receives an encapsulated frame, it forwards it out interfaces.
  • Host A wants to get to Host B. Host A knows Host B's MAC address. So Host A sends a frame out to Switch A.
  • Switch A does not have Host B in its MAC address Table. Switch A then flood out the frame on all of its ports, except for the one Host A is located. Among all those ports there is the ports that Switch B is plugged into, so Switch B receives the frame.
  • Switch B then flood that frame out all of its ports (considering Switch B does not have Host B in its MAC address Table).
  • Host B will respond to the frame, Switch B will then record Host B MAC address and send the response to Switch A. Switch A then records the MAC address of Host B in its table and send the response to Host A

How does a Layer 3 switch work?

When it comes to Layer 3 switching, there are two kinds: hardware and software. With a hardware-based service, the device is using an application-specific integrated circuit, or ASIC -- a dedicated chip -- to perform the packet-switching function. With the software implementation, the device is using a computer processor and software to perform the function.
Generally, Layer 3 switches and high-end routers route packets use hardware -- ASICs -- and general-purpose routers use software to perform routing functions.

Why use a Layer 3 switch?

Layer 3 switches make the use of virtual local area networks (VLANs) and interVLAN routing easier and faster. They make VLANs easier to configure, because a separate router isn't required between each VLAN; all the routing can be done right on the switch.
---------------------------
Both L3 Switch and a router operate in Network layer of OSI ,There are many more differences between a Layer 3 switch and a router ...
1) L3 Switch supports Ethernet interfaces where as a router supports Ethernet,DS3,Serial etc ..
2) L3 Switch doesnt have an option of NAT (Private to public and vice versa )  but a router has ...
3) Router supports encapsulation techniques like GRE,IPSEC even MPLS if appropirate licenses are put ...

Now lets look into the scenario where to use what 
L3-Switch 
1) If you need to connect your Hub rooms and make a L3 decision and more ethernet interfaces are required for direct server form connectivity then you can use a switch.
2) If you need to connect your inter-offices via l2 circuits by the ISP you can directly terminate the link on the Switch and configure  routing on the same.
3) If you need more through-put and direct access and intervlan communication switch is the best bet.
Router : 
1)If you are connecting a ISP directly to provide internet then router is the box you need to deploy.
2)If you need to build tunnels between your offices  (connecting 2 offices over public internet securely ) then you need a router .
3) If the ISP says he can give an non ethernet handout (which is very much unlikely) then you need to go for router .
4)If you are a CE participating in MPLS configuration then you need a router .





No comments:

Post a Comment