Router Architecture
High level view of generic router architecture:
- Set of input/output ports for a router
- Physically the same, but distinct functions
- High-speed switching fabric between ports forwards from input to output ports
- Routing processor takes care of maintaining/creating forwarding rules
- Runs in control plane (implemented in software)
- Forwarding data plane operates in hardware

Input Port Functionality
- Physical Layer Functionality
- terminates incoming physical link at router
- Receives bits and passes them to link layer protocol
- Decentralized Switching
- With headers, lookup output port using forwarding table in input port memory (i.e. “match plus action”)
- Should process as fast as “line speed”
- Input port queueing occurs if datagrams arrive faster than forwarding rate into switch fabric
- Destination-based forwarding
- Forward only based on destination IP address
- Traditional approach
- Generalized forwarding
- Forward based on any set of header field values

Longest Prefix Matching
When looking for the forwarding table entry for a given destination address, use the longest address prefix that matches the destination address.
- e.g. Given the following table:
-
IP addresses are 4 bytes long

-
The first address will be forwarded to link interface 0

-
Second address will be forwarded to link interface 1, as it matches a longer prefix than 2

Longest prefix matching is often performed using ternary content addressable memories (TCAMs).
- Content addressable ⇒ Can retrieve address in 1 clock cycle, regardless of table size
- Cisco Catalyst has around 1 million entries in TCAM