Home > Articles > Networking

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

BGP Policy Accounting

BGP policy accounting (BPA) is another BGP feature that takes advantage of the FIB policy parameters. In this case, the parameter is traffic index. Traffic index is a router internal counter within a FIB leaf with values between 1 and 8. Think of the traffic index as a table of eight independent buckets. Each can account for one type of traffic matching certain criteria. The number of packets and bytes in each bucket of an interface is recorded.

You can use this feature to account for IP traffic differentially on an edge router by assigning counters based on BGP prefixes and attributes on a per-input interface basis.

Configuration of BPA generally involves the following steps:

Step 1

Identify BGP prefixes that require preferential treatment and tag them with appropriate BGP attributes.

Step 2

Set a FIB traffic index for each type of traffic.

Step 3

Enable BPA on an incoming interface.

Figure 4-10 shows how BGP policy accounting works. As prefix is propagated from AS 200 to AS 300, certain BGP attributes are modified. On R4, a traffic index number can be set when a match is made for the attributes using the table-map command. A total of eight traffic classes can be accounted.

Figure 10Figure 4-10 How BGP Policy Accounting Works


Remember that changes to the FIB/RIB tables are updated when the IP RIB is cleared using clear ip route *, the BGP session is reset, or a router is reloaded. All these actions can be disruptive to the traffic.

On each incoming interface, you can enable policy accounting by using the command bgp-policy accounting. With this command, using destination IP addresses, traffic matching the criteria is accounted for in its respective bucket. The show cef interface policy-statistics command displays the per-interface table of traffic counters. The counters can be cleared using the clear cef interface policy-statistics command.

Using the topology shown in Figure 4-9, an example of BGP policy accounting is demonstrated here. For the prefix, the BGP community is set as before. On R3, a route map is created to update the FIB traffic-index, as shown in Example 4-37.

Example 4-37 Sample BGP Configuration on R3

router bgp 100
 table-map Set-policy
 neighbor remote-as 100
 neighbor remote-as 300
ip community-list 1 permit 100:200
route-map Set-policy permit 10
 match community 1
 set traffic-index 1

The updated FIB for the prefix is shown in Example 4-38. To account for the prefix, policy accounting is enabled on FastEthernet 10/0. This is the incoming interface for traffic destined for Note that this interface doesn't account for the return traffic, because the matching is done on the destination address. To account for the return traffic, policy accounting must be enabled on GigabitEthernet 6/0, and appropriate criteria must be set using the addresses of AS 300. Example 4-39 shows the accounting statistics on FastEthernet 10/0.

Example 4-38 FIB Traffic Index for

R3#show ip cef, version 23, cached adjacency
0 packets, 0 bytes, traffic_index 1
 via, 0 dependencies, recursive
  next hop, GigabitEthernet6/0 via
  valid cached adjacency

Example 4-39 Policy Accounting Statistics on FastEthernet10/0

R3#show cef interface policy-statistics | begin FastEthernet10/0
FastEthernet10/0 is up (if_number 19)
 Corresponding hwidb fast_if_number 19
 Corresponding hwidb firstsw->if_number 19
BGP based Policy accounting is enabled
 Index     Packets      Bytes
   1     867256    86725600
   2        0        0
   3        0        0
   4        0        0
   5        0        0
   6        0        0
   7        0        0
   8        0        0
  • + Share This
  • 🔖 Save To Your Account