What are Functions of Network Switch?

Advertisements

The function of Network Switch –

An Ethernet/Network Switch operates at the data link layer (layer 2) of the OSI model. Unlike a hub, a switch forwards a message to a specific host.

When any host on the network or a switch sends a message to another host on the same network or same switch, the switch receives and decodes the frames to read the physical (MAC) address portion of the message.

An Ethernet switch creates a separate collision domain for each switch port. Each device connected to a switch port can transfer data to any of the other ones at a time, and the transmissions will not interfere, with a caveat that in half-duplex mode, each switch port can only either receive from or transmit to its connected device at a certain time.

In full-duplex mode, each switch port can simultaneously transmit and receive, assuming the connected device also supports full-duplex mode.

Layer 2 switching is hardware-based, it uses the host’s Media Access Control (MAC) address. Switches use Application Specific Integrated Circuits (ASIC) to build and maintain filter tables.

The function of Switche process faster than Routers, instead use the hardware address defined at the Data Link (MAC) layer to decide whether to forward or discard the frame, unlike Router which works on Layer 3 and uses the destination IP address for forwarding packets.

Uses Layer 2 switching for network connectivity and network segmentation (each port is a separate collision domain).

Functions of layer 2 switching are –

  1. Address Learning
  2. Forward/Filter decisions
  3. Loop Avoidance

1. ADDRESS LEARNING –

An Ethernet switch controls the transmission of frames between switch ports connected to Ethernet cables using the traffic forwarding rules described in the IEEE 802.1D bridging standard.

Related – Patch cable vs Ethernet

Traffic forwarding is based on address learning. Switches make traffic forwarding decisions based on the 48-bit media access control (MAC) addresses used in LAN standards, including Ethernet.

To do this, the switch learns which devices, called stations in the standard, are on which segments of the network by looking at the source addresses in all of the frames it receives.

When an Ethernet device sends a frame, it puts two addresses in the frame. These two addresses are the destination address of the device it is sending the frame to, and the source address, which is the address of the device sending the frame.

The way the switch “learns” is fairly simple. Like all Ethernet interfaces, every port on a switch has a unique factory-assigned MAC address.

However, unlike a normal Ethernet device that accepts only frames addressed directed to it, the Ethernet interface located in each port of a switch runs in promiscuous mode.

In this mode, the interface is programmed to receive all frames it sees on that port, not just the frames that are being sent to the MAC address of the Ethernet interface on that switch port.

As each frame is received on each port, the switching software looks at the source address of the frame and adds that source address to a table of addresses that the switch maintains.

This is how the function of a switch automatically discovers which stations are reachable on which ports.

Figure 1-2 shows a switch linking six Ethernet devices. For convenience, we’re using short numbers for station addresses, instead of actual 6-byte MAC addresses.

As stations send traffic, the switch receives every frame sent and builds a table, more formally called a forwarding database, that shows which stations can be reached on which ports.

After every station has transmitted at least one frame, the switch will end up with a forwarding database such as that shown in Table 1-1.

Related- Functions of switch

2. FORWARDING AND FILTERING –

Forwarding is the process of passing network traffic a device connected to one port of a Network Switch to another device connected to another port on the switch.

When a Layer 2 Ethernet frame reaches a port on the Network Switch the switch reads the source MAC address of the Ethernet frame as a part of learning function, and it also reads the destination MAC address also as a part of the forwarding function.

The destination MAC address is important to determine the port number which the destination device is connected.

If the destination MAC address is found on the MAC address table, the switch forwards the Ethernet frame via the corresponding port of the MAC address.

If the destination MAC address is not found on the MAC address table, the switch forwards the Ethernet frame through all its ports except the source port. This is known as flooding.

Normally flooding happens when the network switch is starting up. Flooding prevents loss of traffic when the switch is learning.

When the destination device receives the Ethernet frame and sends a reply frame to the source device, the switch reads the MAC address of the destination device and add it to the MAC address table, which is the function of the learning process.

If the source MAC address is the same as the destination MAC address, the switch will drop the Ethernet frame. This is known as filtering.

This will normally happen if there is a hub connected to a port of the switch, and both the source device and destination device are connected to the hub.

Related- Networking Scenario Based Interview Questions

3. LOOP AVOIDANCE –

In practical Local Area Networking, redundant links are created to avoid complete network failure in an event of a failure in one link.

Redundant links can cause layer 2 switching loops and broadcast storms. It is the function of a network switch to prevent layer 2 switching loops and broadcast storms.

Spanning Tree Protocol (STP) is used to stop network loops while still permitting redundancy

Spanning Tree Protocol is designed to perform port state transition to mitigate switching loops and allow the primary or preferred path active.

The port states are as below –

Blocking – doesn’t forward any frames, but still listens to BPDUs.  Ports default to blocking when the switch powers on.

Used to prevent network loops.

If a blocked port is to become the designated port, it will first enter the listening state to ensure that it won’t create a loop once it goes into the forwarding state.

Listening – listens to BPDUs to ensure no loops occur on the network before passing data frames.

Learning – learns MAC addresses and builds filter table, doesn’t forward frames.

Forwarding – sends and receives all data on the bridge ports.  A forwarding port has been determined to have the lowest cost to the root bridge.

Hope you would have understood the function of the switch. Read our other blogs as well –

Difference between Network Switch and Hub

Switching Top 50 Interview Questions

Watch the video related to Functions of Switch –

 

Tags:

Related Posts

About The Author

No Responses

Add Comment

Social Media Auto Publish Powered By : XYZScripts.com
Select your currency
USD United States (US) dollar