July 15, 2011

BGP Summarization Part 1

BGP Summarization Part 1
Erick N. Borgard CCNP

This blog post will focus on the first part of BGP summarization.  BGP administrators use summarization reduce the the size of the internet routing table, thereby conserving resources.  I think at this time, the BGP table is at 350,000 routes.  Can you imagine what it would be like if engineers didn't use any form of summarization?  Summarization also indirectly hides potential problems in thenetwork.  If a router were summarizing 100.100.10.0 – 100.100.50.0, any potential problems with the 100.100.20.0 network would stop at the aggregating router since it's only telling it's neighbor about a summary of more specific addresses.

Before moving into the first part of summarization, it's important to get one of the critical foundational topics mastered.  We are going to look at the use of the network command in BGP.  The network command in BGP is not used the same way the network command works with a traditional IGP such as EIGRP & OSPF.  To get a Cisco router to advertise a network into BGP, the statement must match the prefix and prefix length as it is in the IP routing table exactly.  If it doesn't then the router will not tell it's neighbor about the route. Let's take a look at an example.

Diagram 1-1


In this example, I have configured a loopback and a few secondary addresses associated with the loopback.

R1#show ip route | beg Gate
Gateway of last resort is not set

    10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C      10.10.10.0/24 is directly connected, Loopback1
C      10.10.20.0/24 is directly connected, Loopback1
C      10.10.30.0/24 is directly connected, Loopback1
C      10.10.40.0/24 is directly connected, Loopback1
C      10.10.50.0/24 is directly connected, Loopback1


For this example, let's advertise 10.10.30.0/24 to R2.  First we will advertise it with the default subnet mask of 255.0.0.0.  Remember that 10.x.x.x is a class A network by default.  If we advertise the network into BGP with no mask configured, it will default to be 255.0.0.0 in this example.  We will see that the route will not be advertised to R2 because the prefix and prefix length must match the routing table exactly.  We will use the following syntax.

Configure terminal
!
!
router bgp 100 
network 10.10.30.0
!
end

R2#show ip bgp

R2#

Nothing. Notice that there is no output on the CLI.  We are not receiving the route because the default prefix length of /8 does not match what's in the routing table, a /24.  Let's change the configuration so we have the mask exactly like it is in the routing table.

Configure terminal
!
!
router bgp 100 
network 10.10.30.0 mask 255.255.255.0
!
end

Notice in the second configuration, we added the mask.  Now let's check to see if R2 is receiving the BGP route.

R2#show ip bgp
BGPtable version is 4, local router ID is 10.1.1.2
Status codes: s suppressed, d damped, h history, * valid, > best, i -internal,r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

  Network        Next Hop             Metric   LocPrf Weight Path
*>10.10.30.0/24  10.1.1.1                  0               0 100i

Now that we got the prefix length to match the route in the routing table, R1 will advertise the 10.10.30.0/24 network to R2.  This is an important concept to keep in mind while discussing the first part of BGP summarization.

There are two schools of thought when it comes to BGP summarization. One school uses the “static route” method and either use the network command to advertise the route or redistribute it into BGP so the neighboring routers get the summary.  We will look at this method in part 1.

The other school of thought is to use the aggregate-address command.  The aggregate address command has more features tied to it, so this is the method employed by most engineers today.  There are some subtle difference in how things are configured, but in the end, the resultis the same.


Using the“Static Route” Method


This method uses the above concept to advertise a summary route to it's neighbors.  The concept is that the engineer will create a summary route and point it to the null0 interface.(the trash can or bitbucket)

The route to null0 will serve two purposes in this case.  The first purpose of the static route to null0 is to prevent any potential routing loops if all of the more specific routes were to lost in the routing table for any reason.  The second thing the null0 route doesis it serves as a point of reference for the router when we use the network command to advertise the summary.  What is the router going to do when we type a summary address with the network command?  Yep. The router is going to look in the routing table to make sure the prefix & prefix length match the route in the routing table.  In this case, it will use the static route we created.  If we go back and look at the routing table, we can summarize the following on R1 by calculating the summary with binary math.

    10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C      10.10.10.0/24 is directly connected, Loopback1
C      10.10.20.0/24 is directly connected, Loopback1
C      10.10.30.0/24 is directly connected, Loopback1
C      10.10.40.0/24 is directly connected, Loopback1
C      10.10.50.0/24 is directly connected, Loopback1


Write the prefixes out in binary and summarize the most significant bits from left to right.

00001010.00001010.00001010.00000000= 10.10.10.0
00001010.00001010.00101000.00000000= 10.10.20.0
00001010.00001010.00011110.00000000= 10.10.30.0
00001010.00001010.00101000.00000000= 10.10.40.0
00001010.00001010.00110010.00000000= 10.10.50.0

We can take those routes and summarize them to 10.10.0.0/18.  All of those addresses have the first 18 bits in common as outlined in bold numbers.  So now we know the summary address we can configure the static route and point it to the null0 interface.  The command to do this will be.
  • Ip route 10.10.0.0 255.255.192.0 null0
 To verify, we can now look at the IP routing table.


R1#show ip route | in Null
S      10.10.0.0/18 is directly connected, Null0

Now that we have met the requirement that the route must be in the routing table, we can match that and advertise it to R2.  We can do this by using the network command or with redistribution.  The engineer can also call a route-map from the network command so there is no need to use redistribution just to call a route-map. I will show both ways just to be sure it's understood how to accomplish this.

The first method is with redistribution.  Simply go to the BGP processand type redistribute static.

The results of the show ip bgp on R2 is as follows after the redistribution and the BGP process cleared.

R2#show ip bgp | beg Or
Origincodes: i - IGP, e - EGP, ? - incomplete

Network         Next Hop         Metric    LocPrf  Weight Path
*>10.10.0.0/18  10.1.1.1              0                 0 100 ?
*>10.10.30.0/24 10.1.1.1              0                 0 100 i

From that output, we can see R2 received the summary route with an origin of “incomplete”.  This means that this route was learned by some other external source other than the network command.  If the network command would have been used, the summary route would have and “i” next to it designating that it is an internal route as the10.10.30.0/24 prefix.

Now let's remove the redistribution statement and use the network command to get that summary to R2.  We will use the network 10.10.0.0 mask 255.255.192.0 command this time and verify with R2.

R2(config)#do sh ip bgp | beg Or
Origincodes: i - IGP, e - EGP, ? - incomplete

Network         Next Hop            Metric  LocPrf  Weight Path
*>10.10.0.0/18  10.1.1.1                 0               0 100 i
*>10.10.30.0/24 10.1.1.1                 0               0 100 i

Notice this time that the summary route now has an “i” for path meaning it is internal.  This is also the expected output for using the network command to send the summary route.

**Hint** While discussing this method, it's probably a good time to briefly mention the ways to advertise a default route with BGP.  After all, what is a default route if it isn't an “all-encompassing” summary route?  The engineer can create a static default route and point itto the null0 interface and then use redistribution or the network command to advertise a default route.

Here is the configuration.

Ip route 0.0.0.0 0.0.0.0 null0
!
router bgp 100
network 0.0.0.0


The other method to use is to advertise the default route on a per-neighbor basis.
  • Neighbor x.x.x.x default-originate
In part two of this series, I will take a look at BGP summarization with the aggregate-address command.

No comments:

Post a Comment