- Cisco Express Forwarding (CEF)
- Content-addressable memory (CAM)
- Ternary CAM (TCAM)
- FIB
- Adjacency types
- Load-balancing
- ECMP group
Cisco Express Forwarding (CEF)
- CAM table: if destination = own port, call FIB
- FIB: address + mask, next-hop MAC, VLAN ID
- TCAM: ACLs
- operations in ASIC are parallel, match is found in single run
- accelerated CEF: central FIB is cached on linecard
- distributed CEF: each linecard has its own CEF
- must be enabled on ingress interface, otherwise:
- process switching: if egress interface is process switched
- fast switching: if egress interface is fast switched or CEF-enabled
- B-tree
- 256 nodes on a level
- leaves: pointer to adjacency entry or hash table (multipath)
- hash table uses the number of buckets, divided by number of links in multipath
Process switching
- done by CPU
- ARP request/reply: CEF glean
- IP packets that require a reply: TTL expired, MTU exceeded, ICMP redirect
- relayed bcasts
- IGP messages
- CDP, LLDP
- encryption, compression
- ACL with log
- NAT
- legacy protocols (IPX, AppleTalk)
- no entry in FIB or FIB is full
- per-packet load-balancing
Fast switching
- CPU + cache
- per-destination load-balancing
- cache aging:
- 1/20 per minute
- 1/5 per minute if memory is low
(config-if)# ip route-cache [cef]
Content-addressable memory (CAM)
- if CAM gets full, switch → hub
Ternary CAM (TCAM)
- ACL
- 3 operations to verify a match
- ACL search in one run
- feature manager (FM) compiles ACEs into TCAM
- entry:
- value:
- 134 bits
- src + dst address, other info
- mask:
- 134 bits
- bits of interest form value
- result:
- 134 bits
- number (mapped to action)
- value:
- table is sorted by mask
- logical operation unit (LOU) performs comparisons
IP protocol | IP ToS | Src IP | Src port | SLOU | Dst IP | Dst port | DLOU | Result PTR | |
---|---|---|---|---|---|---|---|---|---|
mask 1 src IP: 255.255.255.255 dst IP: 0.0.255.255 | TCP | 192.168.199.14 | 10.41.0.0 | 23 | → | ||||
UDP | 192.168.100.0 | → | |||||||
mask 2: dst IP: 0.0.0.255 |
LOU registers:
1 | 2 | |
---|---|---|
A | gt 1024 | – |
B | range start 1024 | range end 2047 |
# show platform tcam utilization
FIB
- sorts the list: prefixes with longer mask – in the beginning
- contains host routes
- version: last modification
- epoch: last flush®enerate
- references an entry in adjacency table
; CEF
# show ip cef
; fast-switching cache
# show ip cache
Adjacency types
- null
- drop
- encapsulation failure
- unresolved address (no intf):
- recursive routing
- next-hop is missing
- unsupported protocol
- no valid route
- no valid adj:
- no ARP reply
- buffer is full
- CRC error
- glean: ARP request is sent, no reply is yet received
- discard: reject because of ACL
- punt
- send packets to CPU, CEF cannot process
- incomplete adj: increases with ARP throttling timer tick
- no_encap: no ARP reply, increases with every packet during ARP throttling
- packet no supported
- ICMP redirect
- L3 engine, IP network/bcast address
- IP options
- ACL failure
- fragmentation failure
# show adjacency [detail]
# show cef not-cef-switched
Load-balancing
- modes:
- per packet
- no polarization
- process switched
- round-robin over egress links
- per destination
- default
- hash(src, dst): CEF
- hash(dst): fast switching
- every flow follows a single path ⇒ no out-of-order packets
- per packet
- algorithm
- L4 ports: universal + L4 ports
- universal: default, original + seed
- tunnel: useful for polarized traffic across several tunnels
- original: unseeded, CEF polarization prone
- MLS load-sharing
- default: src IP + dst IP + Universal ID
- full: src+dst IP+L4, prone to polarization
- simple: src IP + dst IP
- full simple: full with less HW utilization
- universal ID makes hash over same data different on different devices ⇒ mitigates polarization (same hash into same buckets on every device, rest links are unused)
(config)# ip cef load-sharing universal|tunnel|include-ports <UNIVERSAL_ID>
; CEF starts counting packets and bytes
(config)# ip cef accounting per-prefix
(config)# mls ip cef load-sharing full|simple|full simple
; ingress interface, balancing using adjacency table
(config-if)# ip load-sharing per-packet|per-destination
# show ip cef exact-route <SRC_IP> <DST_IP>
# show ip cef summary
# show cef state
# debug ip cef drops
Polarization
- hash is the same on every hop ⇒ matches same buckets ⇒ downstream flows are not distributed
Polarization & failover
ECMP group
- prefixes with equal info in adjacency table
- saves TCAM
- per-prefix MPLS label allocation creates different ECMP groups: MPLS labels are different and labels are part of adjacency entry