To view routes in the BGP routing table, use the show ip bgp command in privileged EXEC mode. The output lists both best and nonbest paths to each destination. If a VRF instance is specified, the IPv4 routes in the BGP routing table of the VRF instance are displayed.
| Format | show ip bgp [vrf vrf-name] [network/pfx-len [ longer-prefixes | shorter-prefixes [length] ] | filter-list as-path-list | prefix-list pfx-list-name] |
| Mode | Privileged EXEC |
| Parameter | Description |
|---|---|
| network/pfx-len | (Optional) Display a specific route identified by its destination prefix |
| longer-prefixes | (Optional) Used with the network/pfx-len option to show routes whose prefix length is equal to or longer than pfx- len. This option may not be given if the shorter-prefixes option is given. |
| shorter-prefixes [length] | (Optional) Used with the network/pfx-len option to show routes whose prefix length is shorter than pfx-len, and, optionally, longer than a specified length. This option may not be given if the longer-prefixes option is given. |
| filter-list as-path-list | (Optional) Filter the output to the set of routes that match a given AS Path list. This option may not be given if a network/pfx-len option is given, or when a prefix list is given. |
| pfx-list-name | (Optional) Filter the output to the set of routes that match a given prefix list. This option may not be given if a network/pfx-len option is given or when a filter list is given. |
The command output displays the following information.
| Parameter | Description |
|---|---|
| BGP table version | Each time phase 2 of the BGP decision process runs to select new BGP routes, this number is incremented |
| Status codes |
|
| Network | Destination prefix |
| Next Hop | The route's BGP NEXT HOP |
| Metric | Multi Exit Discriminator |
| LocPrf | The local preference |
| Path | The AS path |
|
Note: The value of the ORIGIN attribute follows immediately after the AS PATH.
|
|
Example: The following shows example CLI display output for the command.
Example #1:
(R1) # show ip bgp
BGP table version is 5, local router ID is 20.1.1.1
Status codes: s suppressed, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Path
*> 172.20.1.0/24 100.10.1.1 10 100 20 10 i
200.10.1.1
*> 172.20.2.0/24 100.10.1.1 10 100 20 10 ?
Example #2: If one or more of the three well-known communities in RFC 1997 is attached to a path, show ip bgp lists them.
(R1) # show ip bgp BGP table version is 5, local router ID is 20.1.1.1 Status codes: s suppressed, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Path *> 172.20.1.0/24 100.10.1.1 10 100 20 10 i Communities: no-export *> 24.95.16.0/24 100.10.1.1 10 100 20 10 i Communities: no-advertise *> 24.14.8.0/24 100.10.1.1 10 100 20 10 i Communities: no-export-subconfed S*>24.14.9.0/24 100.10.1.2 10 100 30 20 i
If the command is given with network/pfx-len option and without any additional options, then the output format lists more information about the individual prefix. The best path is always listed first, followed by any nonbest paths. The output only shows attributes that are included with each path.
| Parameter | Description |
|---|---|
| Prefix/Prefix Length | The destination prefix and prefix length. |
| Generation ID | The version of the BGP routing table when this route last changed. |
| Forwarding | Whether this BGP route is used for forwarding. |
| Advertised To Update Groups | The outbound update groups that this route is advertised to. |
| Local Preference | The local preference, either as received from the peer or as set according to local policy. |
| AS Path | The AS Path. This form of show ip bgp displays AS Paths as long as allowed by bgp maxas-limit. |
| Origin | Value of the ORIGIN attribute. |
| Metric | Value of the MED attribute, if included. |
| Type | Whether the path is received from an internal or external peer. |
| IGP Cost | The interior gateway cost (e.g., OSPF cost) to the BGP NEXT HOP. |
| Peer (Peer ID) | The IP address of the peer that sent this route, and its router ID. |
| BGP Next Hop | The BGP NEXT HOP attribute. |
| Atomic Aggregate | If the ATOMIC AGGEGATE attribute is attached to the path. |
| Aggregator | The AS number and router ID of the speaker that aggregated the route. |
| Communities | The BGP communities attached to the path. |
| Originator | If the ORIGINATOR attribute is attached to the path, the value of this attribute |
| Cluster List | If the CLUSTER_LIST attribute is attached to the path, the sequence of cluster IDs in the cluster list. |
Example: The following shows example CLI display output for the command.
(R1) # show ip bgp 172.20.1.0/24 Prefix/Prefix Length....................... 172.20.1.0/24 Generation ID.............................. 2056 Forwarding................................. Yes Advertised to Update Groups................ 1, 5 Best Path: Local Preference........................... 100 AS Path.................................... 20 10 Origin..................................... IGP Metric..................................... 10 Type....................................... External IGP Cost................................... 30 Peer (Peer ID)............................. 100.10.1.1 (32.4.1.1) BGP Next Hop............................... 100.10.1.1 Atomic Aggregate........................... Included Aggregator (AS, Router ID)................. 300, 14.1.1.1 Communities................................ no-export Non-best Paths: Local Preference........................... 200 AS Path.................................... 18 50 27 Origin..................................... Incomplete Type....................................... External IGP Cost................................... 10 Peer (Peer ID)............................. 200.1.1.1 (18.24.1.3) BGP Next Hop............................... 200.1.1.1