A switch is a network device which is used to connect multiple devices (routers, computers) inside the LAN (Local Area Network). It operates at Data Link Layer (Layer 2) of the OSI reference model.
Functions of a switch
A list of functions of switches is given below:
- It operates at the data link layer (Layer 2) of the OSI reference model.
- It operates in the full-duplex mode.
- Learning the MAC addresses.
- Preventing and forwarding the frames.
- Filtering and forwarding the frames.
Advantages of Switches
There are the following advantages of Switches –
- Switches increase available network bandwidth.
- Switches increase network performance.
- Switches divide a network into many isolated channels.
- Switches help in logical segmentation by supporting VLAN.
Disadvantages of Switches
There are the following disadvantages of Switches –
- Switches are more expensive as compared to bridges.
- Network connectivity issues are difficult to understand.
- Only used for LAN networks.
Types of Switching
There are mainly three types of switching –
- In circuit switching, a transmission mode involves in setting up a dedicated end to end connection between two communicating devices.
- It is a connection-oriented switching technique.
- It is commonly used in Telephone systems.
- In message switching, there is no dedicated end to end connection between two communicating devices.
- It treats each message as an independent unit and includes its own destination and source address.
- It reduces network traffic congestion.
- The main disadvantage of message switching is that there occur some delay in forwarding the messages.
- In packet switching, a message is broken up into the packets.
- Individual packets take a different route to reach the destination.
- It reduces the required bandwidth.
- In packet switching, if the link fails, it chooses a different route for the remaining packets.
A switch can forward frames using the following switching methods –
1. Store and Forward
In Store and Forward method, a switch copies each frame completely into the switch memory and computes a CRC (Cyclic Redundancy Check) mechanism for checking the errors. If it founds any errors, the frame is discarded. This method ensures error-free network traffic, but the delay is increased due to the inspection of each frame completely. This method also implies more memory and CPU power to carry out the processing.
In Cut-Through switching method, the switch only copies the destination MAC address which is located in the first six bytes of the frame and forwards the frame immediately after it finds an outgoing port for the MAC address in the CAM (Content Addressable Memory) table.
The Fragment-Free method is a combination of both Store and forward, and Cut-Through switching methods. It provides a low latency error-free switching.
In this method, the switch will copy only the first 64 bytes of the frame and check errors caused due to a collision before forwarding it.
Difference between Bridge and Switch
|The bridge is based on software.||The switch is based on hardware.|
|The bridge has a lesser number of ports.||The switch has a higher number of ports.|
|The bridge operates at half-duplex mode.||The switch operates at the half and full-duplex mode.|
|The bridge contains only one instance of spanning tree.||The switch contains many instances of spanning tree.|
Difference between Router and Switch
|It transmits data in the form of packets.||It transmits data in the form of frames.|
|It is used for both WAN and LAN networks.||It is only used for the LAN networks.|
|It uses an IP address for the purpose of data transmission.||It uses MAC address for the purpose of data transmission.|
|Routers can perform NAT (Network Address Translation)||Switches cannot perform NAT (Network Address Translation)|