The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
Border Gateway Protocol (BGP) policy accounting measures and classifies IP traffic that is sent to, or received from, different
peers. Policy accounting is enabled on an input interface, and counters based on parameters such as community list, autonomous
system number, or autonomous system path are assigned to identify the IP traffic.
Finding Feature Information
Your software release may not support all the features documented in this module. For the latest caveats and feature information,
see
Bug Search Tool and the release notes for your platform and software release. To find information about the features documented in this module,
and to see a list of the releases in which each feature is supported, see the feature information table at the end of this
module.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature
Navigator, go to
www.cisco.com/go/cfn. An account on Cisco.com is not required.
Prerequisites
Before using the BGP Policy Accounting feature, you must enable BGP and CEF or dCEF on the router.
Information About BGP Policy Accounting
BGP Policy Accounting Overview
Border Gateway Protocol (BGP) policy accounting measures and classifies IP traffic that is sent to, or received from, different
peers. Policy accounting is enabled on an input interface, and counters based on parameters such as community list, autonomous
system number, or autonomous system path are assigned to identify the IP traffic.
Using the BGP
table-map command, prefixes added to the routing table are classified by BGP attribute, autonomous system number, or autonomous system
path. Packet and byte counters are incremented per input interface. A Cisco IOS policy-based classifier maps the traffic into
one of eight possible buckets, representing different traffic classes.
Using BGP policy accounting, you can account for traffic according to the route it traverses. Service providers (SPs) can
identify and account for all traffic by customer and bill accordingly. In the figure below, BGP policy accounting can be implemented
in Router A to measure packet and byte volumes in autonomous system buckets. Customers are billed appropriately for traffic
that is routed from a domestic, international, or satellite source.
BGP policy accounting using autonomous system numbers can be used to improve the design of network circuit peering and transit
agreements between Internet service providers (ISPs).
Benefits of BGP Policy Accounting
Account for IP Traffic Differentially
BGP policy accounting classifies IP traffic by autonomous system number, autonomous system path, or community list string,
and increments packet and byte counters. Service providers can account for traffic and apply billing, according to the route
specific traffic traverses.
Efficient Network Circuit Peering and Transit Agreement Design
Implementing BGP policy accounting on an edge router can highlight potential design improvements for peering and transit agreements.
How to Configure BGP Policy Accounting
Specifying the Match Criteria for BGP Policy Accounting
The first task in configuring BGP policy accounting is to specify the criteria that must be matched. Community lists, autonomous
system paths, or autonomous system numbers are examples of BGP attributes that can be specified and subsequently matched using
a route map.
To specify the BGP attribute to use for BGP policy accounting and create the match criteria in a route map, use the following
commands in global configuration mode:
Enters route-map configuration mode and defines the conditions for policy routing.
The
map-name argument identifies a route map.
The optional
permit and
deny keywords work with the match and set criteria to control how the packets are accounted for.
The optional
sequence-number argument indicates the position a new route map is to have in the list of route maps already configured with the same name.
Indicates where to output packets that pass a match clause of a route map for BGP policy accounting.
Classifying the IP Traffic and Enabling BGP Policy Accounting
After a route map has been defined to specify match criteria, you must configure a way to classify the IP traffic before
enabling BGP policy accounting.
Using the
table-map command, BGP classifies each prefix it adds to the routing table based on the match criteria. When the
bgp-policyaccounting command is configured on an interface, BGP policy accounting is enabled.
To classify the IP traffic and enable BGP policy accounting, use the following commands beginning in global configuration
mode:
Specifies the interface type and number and enters interface configuration mode.
Step 7
Device(config-if)#
noipdirected-broadcast
Configures the interface to drop directed broadcasts destined for the subnet to which that interface is attached, rather
than being broadcast. This is a security issue.
Step 8
Device(config-if)#
ipaddressip-addressmask
Configures the interface with an IP address.
Step 9
Device(config-if)#
bgp-policyaccounting
Enables BGP policy accounting for the interface.
Verifying BGP Policy Accounting
To verify that BGP policy accounting is operating, perform the following steps:
SUMMARY STEPS
Enter the
showipcef EXEC command with the
detail keyword to learn which accounting bucket is assigned to a specified prefix.
Enter the
showipbgp EXEC command for the same prefix used in Step 1--192.168.5.0-- to learn which community is assigned to this prefix.
Enter the
showcefinterfacepolicy-statistics EXEC command to display the per-interface traffic statistics.
DETAILED STEPS
Step 1
Enter the
showipcef EXEC command with the
detail keyword to learn which accounting bucket is assigned to a specified prefix.
In this example, the output is displayed for the prefix 192.168.5.0. It shows that the accounting bucket number 4 (traffic_index
4) is assigned to this prefix.
Example:
Device# show ip cef 192.168.5.0 detail
192.168.5.0/24, version 21, cached adjacency to POS7/2
0 packets, 0 bytes, traffic_index 4
via 10.14.1.1, 0 dependencies, recursive
next hop 10.14.1.1, POS7/2 via 10.14.1.0/30
valid cached adjacency
Step 2
Enter the
showipbgp EXEC command for the same prefix used in Step 1--192.168.5.0-- to learn which community is assigned to this prefix.
In this example, the output is displayed for the prefix 192.168.5.0. It shows that the community of 100:197 is assigned to
this prefix.
Example:
Device# show ip bgp 192.168.5.0
BGP routing table entry for 192.168.5.0/24, version 2
Paths: (1 available, best #1)
Not advertised to any peer
100
10.14.1.1 from 10.14.1.1 (32.32.32.32)
Origin IGP, metric 0, localpref 100, valid, external, best
Community: 100:197
Step 3
Enter the
showcefinterfacepolicy-statistics EXEC command to display the per-interface traffic statistics.
In this example, the output shows the number of packets and bytes that have been assigned to each accounting bucket:
(Optional) Displays entries in the BGP routing table.
Device# showipcef[network[mask]] [detail]
(Optional) Displays entries in the Forwarding Information Base (FIB) or FIB summary information.
Configuration Examples for BGP Policy Accounting
Example: Specifying the Match Criteria for BGP Policy Accounting
In the following example, BGP communities are specified in community lists, and a route map named set_bucket is configured
to match each of the community lists to a specific accounting bucket using the
settraffic-index command:
ip community-list 30 permit 100:190
ip community-list 40 permit 100:198
ip community-list 50 permit 100:197
ip community-list 60 permit 100:296
!
route-map set_bucket permit 10
match community 30
set traffic-index 2
!
route-map set_bucket permit 20
match community 40
set traffic-index 3
!
route-map set_bucket permit 30
match community 50
set traffic-index 4
!
route-map set_bucket permit 40
match community 60
set traffic-index 5
Example: Classifying the IP Traffic and Enabling BGP Policy Accounting
In the following example, BGP policy accounting is enabled on POS interface 7/0 and the
table-map command is used to modify the bucket number when the IP routing table is updated with routes learned from BGP:
router bgp 65000
table-map set_bucket
network 10.15.1.0 mask 255.255.255.0
neighbor 10.14.1.1 remote-as 65100
!
ip classless
ip bgp-community new-format
!
interface POS7/0
ip address 10.15.1.2 255.255.255.0
no ip directed-broadcast
bgp-policy accounting
no keepalive
crc 32
clock source internal
Cisco Express Forwarding (CEF) and distributed CEF (dCEF) configuration information
“CEF Overview” module of the
Cisco IOS Switching Services Configuration Guide
MIBs
MIB
MIBs Link
CISCO-BGP-POLICY-ACCOUNTING-MIB
Note
CISCO-BGP-POLICY-ACCOUNTING-MIB is only available in the Cisco IOS Release 12.0(9)S, 12.0(17)ST, and later releases. This
MIB is not available on any mainline and T-train release.
To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found
at the following URL:
The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use
these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products
and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.
The following table provides release information about the feature or features described in this module. This table lists
only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise,
subsequent releases of that software release train also support that feature.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco
Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.
Table 1. Feature Information for BGP Policy Accounting
Feature Name
Releases
Feature Information
BGP Policy Accounting
12.0(9)S
12.0(17)ST
12.2(13)T
15.0(1)S
12.2(50)SY
Cisco IOS XE Release 3.8S
Border Gateway Protocol (BGP) policy accounting measures and classifies IP traffic that is sent to, or received from, different
peers. Policy accounting is enabled on an input interface, and counters based on parameters such as community list, autonomous
system number, or autonomous system path are assigned to identify the IP traffic.
The following commands were introduced or modified: