Methods and apparatus are disclosed herein for classifying packets using
ternary and binary content-addressable memory stages to classify packets. One such
system uses a stage of one or more TCAMS followed by a second stage one or more
CAMS (or alternatively some other binary associative memories such as hash tables
or TRIEs) to classify a packet. One exemplary system includes TCAMs for handling
input and output classification and a forwarding CAM to classify packets for Internet
Protocol (IP) forwarding decisions on a flow label. This input and output classification
may include, but is not limited to routing, access control lists (ACLs), quality
of service (QoS), network address translation (NAT), encryption, etc. These IP
forwarding decisions may include, but are not limited to IP source and destination
addresses, protocol type, flags and layer 4 source and destination ports, a virtual
local area network (VLAN) id and/or other fields.