The Network Basics of Bridging, Routing, and Switching
A network node, which is just a device that forwards packets toward a destination, can be a router, bridge, or switch. They operate on different layers of a networking protocol (layered protocols make it easier to modify and implement the networking task).
Routers operate at Layer 3, the packet layer. Routes on a network, whether the global Internet or the network within your company, are the path that messages take to reach their destination.
But Layer 3 packets are placed inside Layer 2 frames, and a network node that only looks at frames is called a bridge. A switch is a bridge that uses frames with special tags called virtual LANs (VLANs), to forward traffic.
Layer 2: Bridging
Bits at Layer 1 are organized into frames at Layer 2. Ethernet frames have a source and destination address and a type field in the header, followed by the “data” (as you might imagine, by definition, all data units at any level carry data). At the end of the Ethernet frame comes a trailer that contains some error-detecting information.
Now, here’s the key: Bridges are the network devices that look at the frame (Layer 2) header to figure out which adjacent system should get the frame next. Bridges adjust the frame source and destination addresses (called Media Access Control addresses, or MAC addresses) so that the frame addresses show each network device that a frame came from and where it is going on each hop from source to destination.
Layer 3: Routing
Wait a minute! A bridge changes the source and destination addresses each hop along the way, which makes it hard for the end systems to figure out where the frame came from and whom to reply to.
That’s where the layers come in. Although a different frame (at least as far as MAC addresses are concerned) is sent hop-by-hop through the network, the data content of the frame, called the Layer 3 packet, remains intact from source host to destination host. The Layer 3 packet can’t use Layer 2 MAC addresses, so the IP address scheme was created for Layer 3.
Network devices that look at the packet (Layer 3) header to figure out which adjacent system should get the frame next are called routers. Routers cannot adjust the packet source and destination addresses (the IP addresses) so that the receiver knows that the packet is for them and where to reply. However, routers do adjust the MAC addresses in the Layer 2 frame hop-by-hop, just like bridges.
(Layer 2) Switching
However, if you define a bridge as a MAC-frame-address-examining-device and a router as an IP-packet-address-examining-device, then there does not seem to be anything left for a switch to do.
Today, when people say “switch,” they usually mean a LAN switch. When applied to LANs, a switch is a device with a number of characteristics that can be compared to bridges and routers.
The LAN switch is really a complex bridge with many interfaces. LAN switching is a form of multiport bridging, where a bridge device connects not just two, but many LANs on different ports. Essentially, though, a LAN switch has every device on its own LAN segment (piece of a LAN), giving each system the entire LAN bandwidth.
Much more can be said about switching, of course, enough to fill a book or two. For now, just remember that switching normally involves virtual LANs, or VLANs.