Welcome to the first in a series of articles that will explore some of the interesting properties we can insert into CEF, Cisco’s implementation of the Forwarding Information Base (FIB) in Layer-3 rotuers. CEF represents the high-speed forwarding architecture in the Cisco platforms. If we can insert data into the CEF memory structure we can create new behaviors with little or no performance penalties.
I like to introduce new topics backwards, meaning I’ll show the end results and work in reverse to produce the steps to get there. As a quick note, I’d love to do these examples with IPv6, but most versions of IOS I have running on GNS3 do not have these features incorporated into IPv6 yet. It’s OK, IPv6 has only been around since RFC2460 in 1998, so give it some time.
Let’s look at the CEF table for a particular prefix. I’ll use the detail keyword because these attributes do not otherwise show up.
R1#show ip cef 192.0.2.0 detail
192.0.2.0/24, epoch 0, flags rib only nolabel, rib defined all labels
QOS: Precedence immediate (2), qos-group 2
BGP: traffic_index 2
recursive via 18.104.22.168
nexthop 192.168.0.2 FastEthernet0/0
I love super-secret hidden stuff. The QOS and BGP fields never show up… unless there’s something to show. Our curiosity piqued, let’s dive in.
This Is Not IP Precedence
It kinda is, but not how we normally use it to mark packet headers. When we talk about IP Precedence we’re talking about the 6-bit DiffServ (DSCP) field in individual IP packet headers. This is something different. It is an ID numbered 0-7 (like ToS) that is attached to the prefix in the route table and then loaded into CEF. You can see it in the RIB with the show ip route command (as long as you specify the exact prefix you want to see.)
R1#show ip route 192.0.2.0
Routing entry for 192.0.2.0/24
Known via "bgp 65000", distance 200, metric 0, precedence immediate (2), qos-group 2, type internal
Last update from 22.214.171.124 00:10:15 ago
Routing Descriptor Blocks:
* 126.96.36.199, from 188.8.131.52, 00:10:15 ago
Route metric is 0, traffic share count is 1
AS Hops 0
MPLS label: none
This is not the QoS-Group tag for packets
In Cisco’s literature the QoS-Group is generally used with the set command in a route-map for PBR or a Modular QoS CLI (MQC) policy-map. It doesn’t modify the packet and is only locally significant. It follows the packet through the internal logic of the router, which can then be used in a match statement on an outbound interface and can be given special treatment.
But the CEF table is not marking a packet. We have marked a prefix in the RIB with a QoS tag that is locally significant, which is then loaded into CEF. Interesting.
What Does BGP Have To Do with This?!?
That’s the big question! The traffic_index references BGP so it must be involved in some fashion. This is just another ID (1-64) that gets tagged onto the prefix in the RIB. The show ip route command will not show the traffic index but we know it’s there because it then gets loaded into the CEF table. What we then do with this information in CEF will be explained in Part 2. That’s a serious network-nerd cliff hanger if I ever saw one!