Displaying BGP advertised routes. Difference between IOS and IOS-XR.

In this post I would like to show you how different IOS types may provide you different show outputs. Particularly, we will be focusing on show ip bgp neighbors advertised-routes command.
First, I’ve configured topology shown below where R1 and R2 are eBGP neighbors and R1 is advertising two loopbacks to R2. Loopback 0 – 1.1.1.1/32 and Loopback 10 – 10.10.10.1/24

2

Below output from R2 confirms that this router is indeed receiving both prefixes.

R2#show ip bgp
BGP table version is 3, local router ID is 10.10.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.1/32       10.10.12.1               0             0 100 i
*> 10.10.10.0/24    10.10.12.1               0             0 100 i

Now we will configure R1 in such a  way, that it advertises only 10.10.10.0/24 and this prefix will be sent with modified AS-Path information.

R1(config)#ip prefix-list BGP seq 5 permit 10.10.10.0/24
R1(config)#route-map BGP-OUT permit 10
R1(config-route-map)#match ip address prefix-list BGP
R1(config-route-map)#set as-path prepend 100 100 100
R1(config-route-map)#exit
R1(config)#router bgp 100
R1(config-router)#neighbor 10.10.12.2 route-map BGP-OUT out

Let’s do the same show command on R2 again and it should confirm the changes.

R2#show ip bgp
BGP table version is 5, local router ID is 10.10.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    10.10.12.1               0             0 100 100 100 100 i

Everything works and we verified it, but what if R2 is managed by another company and we don’t have a change to confirm changes from R2? There should be a way on R1 to see what it has advertised to R2, right? There is even a command with advertised-routes keyword.

R1#show ip bgp neighbors 10.10.12.2 advertised-routes
BGP table version is 3, local router ID is 10.10.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    0.0.0.0                  0         32768 i
Total number of prefixes 1

This command acknowledges, that filtering has been done, but what about AS-Path or Next-Hop information? If R2 has received the route with correct Next-Hop and prepended AS-Path, then why output on R1 doesn’t reveal these changes?

Cisco’s explanation of advertised-routes option is “Displays all routes that have been advertised to neighbors.” which is does and we don’t see 1.1.1.1/32 here. Although the output tells that 10.10.10.0/24 is the route that has been advertised to R2, Path Attributes are the ones we have in the Local RIB.

RFC 4271 says this “Although the conceptual model distinguishes between Adj-RIBs-In, Loc-RIB, and Adj-RIBs-Out, this neither implies nor requires that an implementation must maintain three separate copies of the routing information.” So it looks like Classic IOS doesn’t not maintain Adj-RIBs-Out table for each neighbor and the result of this show command is basically filtered Local RIB.

Now, I assume that you know about Adj-RIBs-In, Loc-RIB, and Adj-RIBs-Out, if not, refer to RFC 4271 or this article.

Let’s move on and do the same setup on IOS-XR and see the results. I’ve replicated exactly the same setup. Initially filtering is not applied and R2 receives both prefixes.

RP/0/0/CPU0:R2#show bgp | b Status
Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*> 1.1.1.1/32         10.10.12.1               0             0 100 i
*> 10.10.10.0/24      10.10.12.1               0             0 100 i
Processed 2 prefixes, 2 paths

You may not be familiar with IOS-XR syntax, but note that I’m achieving exactly the same thing as with classic IOS.

RP/0/0/CPU0:R1(config)#prefix-set BGP
RP/0/0/CPU0:R1(config-pfx)#10.10.10.0/24
RP/0/0/CPU0:R1(config-pfx)#end-set
RP/0/0/CPU0:R1(config)#route-policy BGP-OUT
RP/0/0/CPU0:R1(config-rpl)#if destination in BGP then prepend as-path 100 3 endif
RP/0/0/CPU0:R1(config-rpl)#end-policy
RP/0/0/CPU0:R1(config)#router bgp 100
RP/0/0/CPU0:R1(config-bgp)# neighbor 10.10.12.2
RP/0/0/CPU0:R1(config-bgp-nbr)#address-family ipv4 unicast
RP/0/0/CPU0:R1(config-bgp-nbr-af)#route-policy BGP-OUT out
RP/0/0/CPU0:R1(config-bgp-nbr-af)#commit

We need to check if R2’s output has changed after above commands applied to R1

RP/0/0/CPU0:R2#show bgp | b Status
Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24      10.10.12.1               0             0 100 100 100 100 i
Processed 1 prefixes, 1 paths

Great. It worked. Now we will try to verify it from R1 and see the difference between IOS and IOS-XR.

RP/0/0/CPU0:R1#show bgp neighbor 10.10.12.2 advertised-routes
Network            Next Hop        From            AS Path
10.10.10.0/24      10.10.12.1      Local           100 100 100 100i
Processed 1 prefixes, 1 paths

Bingo! The IOS-XR shows the correct Next-Hop and AS-Path values. Referring back to the part of the RFC I quoted, it looks like IOS-XR is maintaining Adj-RIB-Out for each neighbor and see the information which is sent to R2 in Update message.

I hope that this post will save you some time when troubleshooting BGP route advertisements)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s