# Bridge
## What is a Bridge
A bridge is a network device that operates at the Data Link layer of the OSI model. It connects two or more network segments and uses MAC addresses to filter and forward traffic between them. A bridge divides a large network into smaller segments to reduce congestion and improve performance. Unlike a hub, which broadcasts all traffic to all connected devices, a bridge learns which devices are on each segment and only forwards traffic between segments when necessary.
## How a Bridge Works
When a bridge first starts up, it does not know which devices are connected to which of its ports. It begins in a learning mode, examining the source MAC address of every frame it receives and recording which port that MAC address was received from. Over time, the bridge builds a MAC address table that maps each known MAC address to the port on which that device is connected. When a frame arrives at the bridge, the bridge looks up the destination MAC address in its table. If the destination device is on the same segment as the sender, the bridge does not forward the frame to other segments, reducing unnecessary traffic. If the destination device is on a different segment, the bridge forwards the frame to the appropriate segment. If the destination address is not in the table, the bridge forwards the frame to all segments except the one it was received from.
## Advantages of Bridges
Bridges reduce network congestion by keeping local traffic within its segment and only forwarding traffic that needs to cross segment boundaries. They extend the reach of a network by connecting segments that might be too far apart to communicate directly. They create separate collision domains, which improves performance compared to a hub-based network.
## Bridges vs Switches
A switch is essentially a multi-port bridge. While a traditional bridge typically has only two or four ports, a switch has many ports and performs the same MAC address learning and selective forwarding function. Switches have effectively replaced standalone bridges in modern networks. The term bridging is still used conceptually to describe the function of forwarding frames based on MAC addresses at the Data Link layer.Back to Subject