Layer 2 Switching in Computer Network

Computer Network | Layer 2 Switching: In this tutorial, we will learn about the layer 2 switching, functions of layer 2 switching in computer network. By Mahima Rao Last updated : April 26, 2023

Layer 2 Switching

As you know hubs are not intelligent devices. Whenever a hub receives a frame, it broadcasts the frame in all ports. Also, the hub represents a single collision domain i.e. when any 2 hosts send frames simultaneously and a collision occurs. Due to these limitations of Hubs, there are problems in the network.

Bridges were constructed to overcome the limitations of Hubs. Bridges are better than hubs. Bridges are used to connect local area networks. If you want to spread your local area network more then you can do it through the bridges. Bridges use the MAC address to forward the frames. But because the bridges had only 2 port, bridges were also not able to provide a reliable and scalable network.

Switches are used to overcome the limitations of hubs and bridges. Every port of a switch is called single collision domain. Therefore a switch represents multiple collision domains and a single broadcast domain. Switches are an intelligent device.

Switches to determine the destination in Layer 2 switching uses the table of the MAC (Media Access Control) addresses. This table is also called the CAM table. MAC address is hardcoded by the manufacturer on every host's NIC (Network Interface Card). Layer 2 switches Application Specific Integrated Circuits (ASIC) is used to maintain and maintain a table of MAC addresses.

Functions of Layer 2 Switching

Switches on Layer 2 performs 3 important functions:

1. Hardware Address Learning

When the switch is first turned on, the CAM table is empty. When a host frame sends the store address of the switch frame to the CAM table. Because switch does not have the knowledge of the destination host at this time, so switch lets the frame broadcast all other ports except source port.

All hosts discard this frame except for the host that has been sent to this frame. The person who receives the host frame sends the acknowledgment frame to the source host. Now switch stores the source address of this frame in your CAM table.

Whenever a frame is sent to the network, Switch stores its source address in its CAM table. Thus a switch creates your CAM table. Once the switch stores all hosts' MAC addresses, it does not need to broadcast any frame as the first time. Now the frames are sent from the source to the destination like a point to point connection.

2. Forwarding of Frames

As soon as a frame switch interface comes in, its destination MAC address is compared to the MAC addresses of the CAM table. If the destination address matches the frame, then the frame is forwarded only to the port corresponding to that MAC address.

If the destination address of any frame does not match the CAM table then that frame is broadcasted. If a host receives the frame and sends its acknowledgment frame, then stores the address of that frame in the switch CAM table. If someone broadcast hosts or server frames then switch sends such frames to all hosts.

Switches provide 3 methods to forward frames:

  • Store and Forward: The entire frame is copied to memory in this method. After copying the frame, it is performed on Cyclic Redundancy Check (CRC).
  • Cut Through: In this method, the initial 6 bytes are copied from the header of the frame so that the destination host can be identified. This method does not perform any type of error checking.
  • Fragment Free: In this method, 64 bytes of the frame are copied to perform the error checking.

3. Loop Avoidance

It is very important to have multiple links between switches. Because if there is a link down for some reason then the second link can be sent to the frames. But sometimes these multiple links cause many problems in the network.

Because there is more than one link between switches, loops can be created in the network. If no loop avoidance technique is used then the broadcast storm is created in the network. Because of the loops in the network, one can get multiple copies of the host frames.

The Spanning Tree Protocol is used to prevent loops in Layer 2 switching.




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.