Attributes, route-maps, BGP and all it’s glory. The coolest routing protocol – in my opinion.
The more I read about this said protocol the more I want to get my nerd on, and the greater the temptation is to build overly complex solutions.
R1 --- AS200
R2 R3 --- AS100<span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"> </span>
We want traffic to enter AS100 through R2 and use R3 as a backup link. So, what is first thing you think of to accomplish it? MED? Yea, of course.
But, what about something much, much simpler. Let’s bring it right down to routing 101. Remember our dear friend the routing table. Think about how routes are selected. What do we always prefer? The most specific prefix.
So, we are going to send out an aggregate route (summary route) to AS200 from AS100. We will use the aggregate-address command under the BGP process to accomplish this. The trick is to use the summary-only keyword on R3 and not R2. The configuration would be as follows:
12345678910111213141516 <strong>R2</strong>router bgp 100network 192.168.24.0network 192.168.25.0network 192.168.26.0network 192.168.27.0neighbor 172.16.2.1 remote-as 200aggregate-address 192.168.24.0 255.255.252.0<strong>R3</strong>router bgp 100network 192.168.24.0network 192.168.25.0network 192.168.26.0network 192.168.27.0neighbor 172.16.2.1 remote-as 200aggregate-address 192.168.24.0 255.255.252.0 summary-only
The summary-only keyword tells BGP to send only the aggregate-address. Without summary-only, as is the case with R2, BGP will send the aggregate address and the specific routes.
So now R1 has routes coming from both R2 and R3, but because R1 is receiving the aggregate and the specific routes from R2, it will use the more specific routes over the aggregate address. This means that R2 will be the preferred path into AS200 and if R2 goes down, R1 will begin sending traffic to R3 using the aggregate address.
Lesson learned, always find the simplest solution to a problem. Networks can be complicated enough without us making the matters worse.
My mantra, the simpler the better. I always prefer simpler over “cool”.