Layer 3 Switching


The major difference between a router and an L3 switch is that packet switching in a router is done in software by microprocessor-based engines, whereas packet switching in an L3 switch is done in hardware by specific Application Specific Integrated Circuits (ASICs).

Layer 2 switches operate well with reasonably sized broadcast domains/VLANs. The routing between the broadcast domain/VLANs can be addressed via a “router on a stick”. With a Layer 3 switch however, one can utilize inter-vlan routing on the backplane itself.

Routers are typically slower than switches because they perform their lookups in software, unlike switches where the lookup is hardware based. Layer 2 switches operate only on the Ethernet MAC frame. Because of this, we can have a well-defined forwarding algorithm which can be implemented on the silicon. To extend the algorithm to Layer 3 protocols is challenging & not easy, because the forwarding decision in such protocols is typically more complex than that of Layer 2. What further complicates the building of a hardware forwarding engine is IP option processing. This by its very nature causes the length of the IP header to vary. To design this processing into silicon is complex, & even excessive as these options are often under-utilized, if at all, in the IP packets. Lastly, there are multiple Layer 3 routable protocols such as IP, IPX, AppleTalk, even though IP is the dominant one by quite a margin.

In the end, the typical compromise is that you get a backplane where the most common (fast path) forwarding decisions are designed into the silicon, whereas the others are handled typically by the CPU. (Because of IP’s dominance) the Layer 3 switches perform “IP” switching at the hardware level and “bridges” the other Layer 3 protocols at Layer 2.

Thus, Layer 3 switches are routers with fast forwarding done in hardware. IP forwarding typically involves a route lookup, decrementing TTL count & recalculating checksum. The frame is then forwarded with the suitable MAC header to the required egress port. All three of the aforementioned (Lookups, decrementing  TTL, recalculating checksum) can be implemented in hardware. This effectively, gives you your Layer 3 switch.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s