Switching & Bridging

Switching and Bridging

Networking and internetworking devices are commonly classified into four categories: repeaters, bridges, routers, and gateways. This chapter focuses on bridging and switching in local area networks (LANs): how bridges learn and forward frames, how switches relate to bridges, and how loops are prevented using the spanning tree algorithm.

Switching and Bridging
Switching and Bridging

Bridges and LAN Switches

A bridge is a device that connects two or more LAN segments and forwards Ethernet frames between them based on MAC (hardware) addresses. Each connection of a bridge to a LAN is called a port. When multiple LAN segments are connected by bridges, the combined network is called an extended LAN.

Bridges operate at the data-link layer (Layer 2) of the OSI model. They inspect frame headers to determine the source and destination MAC addresses and decide whether to forward, filter, or flood frames. Modern multiport bridges are commonly known as switches. A switch is effectively a multiport bridge implemented in hardware for higher performance.

Basic forwarding behaviour

  • If a frame's destination MAC address is known in the bridge's forwarding table, the bridge forwards the frame only to the corresponding port.
  • If the destination MAC address is unknown, the bridge floods the frame: it forwards the frame out on every active port except the port on which the frame was received.
  • If the destination MAC address equals the source port's segment (i.e., the destination is on the same LAN segment as the source), the bridge filters the frame and does not forward it to other segments.

Learning Bridges

A learning bridge builds and maintains a forwarding table (also called a MAC table) automatically. The forwarding table maps MAC addresses to bridge ports. Maintenance of this table is performed by the bridge itself; human configuration of each host entry is not required.

Learning is performed by inspecting the source MAC address of every frame that the bridge receives. When a frame arrives on a port, the bridge records that the source address is reachable via that port. Entries in the forwarding table are associated with an ageing timeout. If an entry is not refreshed within the timeout period, the bridge removes (ages out) that entry to accommodate moves and topology changes.

Typical behaviour summary:

  • The bridge records the source MAC address and the port on which the frame arrived.
  • When a later frame arrives with that destination MAC, the bridge forwards it only to the learned port.
  • If the destination is unknown, the bridge floods the frame to all other ports.
Learning Bridges
Learning Bridges

Switch versus Bridge

  • A bridge historically refers to a device connecting two LAN segments; a switch is a multiport bridge with many ports implemented in high-speed hardware.
  • Switches typically use ASICs (hardware) to forward frames at wire speed; bridges were originally implemented in software or low-speed hardware.
  • Both maintain a MAC forwarding table and perform learning and ageing; switches add features such as VLAN support and advanced filtering.

Spanning Tree Algorithm

When LANs are interconnected with multiple bridges, redundant paths are often present to improve reliability. Redundant paths cause loops, which lead to problems such as continuous frame replication and broadcast storms. Bridges must prevent indefinite looping of frames. The standard solution is the Spanning Tree Algorithm.

The spanning tree algorithm enables bridges to discover the network topology and to disable just enough ports so that the interconnection forms a loop-free spanning tree. The algorithm was originally developed by Digital Equipment Corporation and later standardised by IEEE as IEEE 802.1D.

Spanning Tree Algorithm

High-level steps of the algorithm:

  • Each bridge has a unique bridge identifier (Bridge ID).
  • All bridges exchange configuration messages containing three key pieces of information: the sending bridge's ID, the ID of the root bridge as believed by the sender, and the distance (measured in hops or path cost) from the sender to that root.
  • Using these messages, the bridges elect one bridge as the root bridge (the bridge with the lowest Bridge ID).
  • Each non-root bridge selects a single root port, the port that gives the shortest path toward the root bridge.
  • For each LAN segment, the bridges connected to that segment select one bridge as the designated bridge for that segment; the designated bridge is responsible for forwarding frames toward the root on behalf of that LAN. The designated bridge is the bridge on that LAN that has the shortest path to the root bridge; ties are broken by lower Bridge ID.
  • Ports that are neither root ports nor designated ports are placed into a blocking state so that they do not forward user frames, thereby eliminating loops. The blocking state still permits the exchange of control messages needed to maintain the spanning tree.

Example from the simple labelling used earlier (bridges labelled B1, B2, B3, ...):

  • If B1 has the smallest Bridge ID, B1 becomes the root bridge and forwards out all its ports.
  • If B3 and B5 are both connected to LAN A, the bridge closer to the root becomes the designated bridge; if both are equally close, the bridge with the smaller Bridge ID is chosen.
  • Similarly, if B5 and B7 are connected to LAN B and both are equally close to the root, the one with the smaller Bridge ID (B5) is the designated bridge.
Spanning Tree Algorithm

Configuration messages exchanged by bridges are used to propagate root selection and path information. The configuration message fields are:

  1. The ID of the sending bridge.
  2. The ID of what the sending bridge believes to be the root bridge.
  3. The distance (in hops or path cost) from the sending bridge to the root bridge.

When a bridge receives a configuration message, it updates its view of the root and path if the received information is superior. A configuration message is considered superior if it:

  • identifies a root with a smaller Bridge ID,
  • identifies the same root but with a shorter distance to the root, or
  • identifies the same root and equal distance, but the sending bridge has a smaller Bridge ID (tie-breaker).

In IEEE 802.1D terminology, the control messages used by STP are called BPDUs (Bridge Protocol Data Units).

Broadcast and Multicast

Most LANs support both broadcast and multicast addressing. Bridges and switches must handle these appropriately:

  • For a broadcast frame (destination broadcast address), a bridge forwards the frame out on every active port except the ingress port so that all segments receive the broadcast.
  • For multicast frames, hosts determine whether to accept a multicast frame. Bridges historically treated multicast like broadcast and flooded it. Modern switches can implement multicast filtering mechanisms (for example, IGMP snooping) to limit multicast forwarding only to ports where group members are present.

Switching Techniques

Switches may use different internal forwarding techniques; the common methods are:

  • Store-and-forward: The switch receives the entire frame, checks it for errors (CRC), and then forwards it. This method avoids forwarding corrupted frames but introduces greater latency.
  • Cut-through: The switch begins forwarding a frame as soon as it has read the destination MAC address (after the first 6+6+2 bytes); this reduces latency but forwards frames even if they are later found to be corrupted.
  • Fragment-free (modified cut-through): The switch waits for the first 64 bytes (which typically contain collision fragments) and then begins forwarding; this represents a compromise between cut-through and store-and-forward.

Practical notes and applications

  • Bridging and switching are essential for scaling LANs: learning and selective forwarding reduce unnecessary traffic on segments and improve overall network performance.
  • Spanning Tree Protocol (STP) is essential in networks with redundancy; without STP or an equivalent protocol, loops will cause broadcast storms and eventual network failure.
  • Modern Ethernet networks use switches rather than simple bridges. Switches provide higher port density, better performance, VLANs, QoS features, and fast hardware learning of MAC addresses.

Key terms: bridge, switch, MAC address, forwarding table, learning bridge, ageing timeout, root bridge, designated bridge, blocking state, BPDU, IEEE 802.1D, store-and-forward, cut-through, multicast, broadcast.

The document Switching & Bridging is a part of the Computer Science Engineering (CSE) Course Computer Networks.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)

FAQs on Switching & Bridging

1. What is the difference between switching and bridging in Computer Science Engineering (CSE)?
Ans. Switching and bridging are both techniques used in computer networks to connect devices. Switching refers to the process of forwarding data packets between different network segments based on the destination address. On the other hand, bridging involves connecting two or more network segments to form a single network. While both techniques serve the same purpose of connecting devices, switching is typically used in larger networks, while bridging is commonly used in smaller networks or to extend network coverage.
2. What are the advantages of switching in Computer Science Engineering (CSE)?
Ans. Switching offers several advantages in computer networks. Firstly, it allows for faster data transmission as it establishes a dedicated path between the source and destination devices. Secondly, switching enables simultaneous communication between multiple devices by creating separate channels for each connection. Additionally, switching enhances network security by isolating network traffic and preventing unauthorized access to data. Lastly, switching provides scalability, allowing networks to easily expand by adding more switches to accommodate additional devices.
3. Can switching and bridging be combined in Computer Science Engineering (CSE)?
Ans. Yes, switching and bridging can be combined in computer networks. This is commonly known as bridged switching or switch bridging. In this approach, switches are used to connect multiple network segments, similar to bridging. However, the switches also incorporate switching capabilities to improve performance and efficiency. Bridged switching offers the benefits of both techniques, allowing for the extension of network coverage while maintaining fast and reliable data transmission.
4. What are some common protocols used in switching and bridging in Computer Science Engineering (CSE)?
Ans. There are several protocols commonly used in switching and bridging. Some examples include: 1. Ethernet: Ethernet is a widely used protocol for local area networks (LANs) that defines how data is transmitted over a network using switches or bridges. 2. Spanning Tree Protocol (STP): STP is a network protocol that prevents loops in bridged or switched networks by dynamically creating a loop-free logical topology. 3. Rapid Spanning Tree Protocol (RSTP): RSTP is an updated version of STP that provides faster convergence and improved network performance. 4. VLAN Trunking Protocol (VTP): VTP is used to manage the addition, deletion, and renaming of VLANs on a network-wide basis. 5. Virtual Router Redundancy Protocol (VRRP): VRRP is a protocol that provides automatic default gateway selections for routers participating in a LAN.
5. How do switching and bridging improve network performance in Computer Science Engineering (CSE)?
Ans. Switching and bridging improve network performance in several ways. By creating dedicated paths for data transmission, switching minimizes collisions and improves overall network efficiency. Switches also have the ability to filter and forward packets only to the intended destination, reducing unnecessary network traffic. Bridging extends network coverage by connecting multiple network segments, allowing devices to communicate seamlessly. This eliminates the need for long network cables and enhances network scalability. Overall, both techniques contribute to faster data transmission, reduced latency, and improved network reliability.
Explore Courses for Computer Science Engineering (CSE) exam
Get EduRev Notes directly in your Google search
Related Searches
mock tests for examination, Viva Questions, Extra Questions, Exam, Important questions, Sample Paper, Switching & Bridging, Switching & Bridging, MCQs, practice quizzes, Switching & Bridging, video lectures, shortcuts and tricks, Semester Notes, past year papers, ppt, Summary, Previous Year Questions with Solutions, Free, Objective type Questions, study material, pdf ;