Monitoring BGP Routes with Matching AS Paths and Regular Expressions for Single Regular Expressions

Purpose

Display information about BGP routes whose AS path matches the specified regular expression. Accepts a single regular expression element. Report whether the indirect next hop of a route is unreachable; if not, display the IGP cost to the indirect next hop.

Regular expressions match numbers for which the specified path is a substring—for example, if you specify 20, 200 matches because 20 is a substring of 200. You can disallow substring matching by using the underscore (_) metacharacter to constrain matching to the specified pattern, for example, _20_.

The show ip bgp quote-regexp and show bgp ipv6 quote-regexp commands display similar information.

Action

To display information about routes whose AS path matches the specified regular expression:

host1#show ip bgp quote-regexp ^200
Local router ID 192.168.1.232, local AS 100
  6 paths, 3 distinct prefixes (324 bytes used)
  3 paths selected for route table installation
  7 path attribute entries (872 bytes used)

Prefix        Next-hop  MED  CalPrf  Weight  AS-path
10.99.1.2/32  10.1.1.2       100     100     200
10.99.1.3/32  10.1.1.2       100     100     200 10
10.99.1.4/32  10.1.1.2       100     100     200 10 20

Note: For single regular expressions without any spaces in them, you can use either show ip bgp regexp or show ip bgp quote-regexp with the same results.

You must enclose all regular expression elements within quotation marks (“ element”) when the regular expressions contain one or more spaces. To display information about routes whose AS path matches the specified regular expression and also has spaces within the regular expression element:

host1#show ip bgp quote-regexp “ 10 20"
Local router ID 192.168.1.232, local AS 100
  6 paths, 3 distinct prefixes (324 bytes used)
  3 paths selected for route table installation
  7 path attribute entries (872 bytes used)

Prefix         Next-hop   MED  CalPrf  Weight  AS-path
10.99.1.4/32   10.1.1.2        100     100     200 10 20

Because the show ip bgp quote-regexp command accepts only one string as an argument to the regular expression, output filtering is possible. To display information about routes whose AS path matches the specified regular expression with output filtering:

host1#show ip bgp quote-regexp ^200 | begin Prefix

Prefix         Next-hop   MED  CalPrf  Weight  AS-path
10.99.1.2/32   10.1.1.2        100     100     200
10.99.1.3/32   10.1.1.2        100     100     200 10
10.99.1.4/32   10.1.1.2        100     100     200 10 20

Meaning

Table 45 lists the show ip bgp quote-regexp command output fields.

Table 45: show ip bgp quote-regexp Output Fields

Field Name

Field Description

Local router ID

BGP router ID of the local router

local AS

Local autonomous system number

paths

Total number of routes stored in the BGP routing table. If several peers have advertised a route to the same prefix, all routes are included in this count.

distinct prefixes

Number of routes to unique prefixes stored in the BGP routing table. If several peers have advertised a route to the same prefix, only the best route is included in this count.

paths selected for route table installation

Number of routes in the BGP routing table that have been inserted into the IP routing table

path attribute entries

Number of distinct path attributes stored in BGP's internal path attributes table. If BGP receives two routes for different prefixes but with identical path attributes, BGP will create only one entry in its internal path attribute table and share it between the two routes to conserve memory.

Prefix

Prefix for the routing table entry

Next hop IP address

IP address of the next router that is used when a packet is forwarded to the destination network

MED

Multiexit discriminator for the route

CalPrf

Calculated preference for the route

Weight

Weight of the route

AS path

Autonomous system path

Related Documentation