How to Advertise a Default Route
There are hundreds upon thousands of routers and devices that make up the internet. They're not all owned by the same company, they're not all made by the same company, and their networks don't all work the same way. Yet somehow, our emails go through and our VPNs stay connected.
We have the Border Gateway Protocol (BGP) to thank for that. With it, the many huge constellations of networks throughout the internet know how to find one another and get from any one spot in the world to another. Default routes, advertised and propagated by BGP, are how networks know where to find one another. In this blog post, we cover a lot: what is a default route, how to configure one, how to spot problems with static routes conflicting with default routes, and how to resolve those conflicts.
What is an Autonomous System?
Quick Definition: The internet isn't one big network of every device in the world — the internet is a network of networks. An autonomous system (AS) is a network or group of networks with one unified routing policy, and they're what make the internet possible. Autonomous systems are networks, sometimes huge networks, that need BGP to coordinate and cooperate.
What is Border Gateway Protocol?
Quick Definition: Border Gateway Protocol, or BGP is the postal system of the internet. Border Gateway Protocol is a universal protocol for exchanging routing and reachability information. BGP is used by autonomous systems to exchange information about themselves with their neighbors. All of the internet's traffic follows paths through the autonomous systems of the world according to exterior gateway information they receive from their neighbors via BGP.
What is a Default Route?
Quick Definition: In Internet Protocol (IP) routing, a default route is what the name suggests the path that a packet will take when there isn't another pre-specified route for that packet. The default route tends to be another router, selected according to the prefix match method. With no other instructions, routers will attempt to forward a packet to the routers with the longest subnet masks or network prefix that corresponds to the destination IP address.
Autonomous Systems Need Default Routes
Summarization inside of BGP is a crucial part of enterprise network administration. The best place to start when discussing summarization is the ultimate summary route: the default route. This is the route that instructs your routers, "If you don't have a more specific prefix, here's how you would get to any other prefix."
Before we get into actually configuring BGP on our devices, we should explain the topology we're imagining. It may help to sketch this out on a post-it as we go through our BGP commands so that you have a sense of the network we're working on. The commands are simple, but visualizing what your autonomous systems might look like can help drive home what your default route summarization is actually doing.
Any time we're experimenting with or practicing networking concepts, we recommend using a virtualized network. That's no different in this case: if you have access to a network virtualization tool, setting up a network topology that reflects the one we're about to describe can help you practice default route summarization on your own.
First of all, we have a ring of six routers (they look like a hexagon). The three routers that sit at the top of the hexagon make an autonomous system that we numbered AS 100: R2-R3-R4. There are three routers that sit at the bottom. They make up a second autonomous system that we numbered AS 200: R6-R8-R7.
As we said, the routers are arranged in a hexagon, so R2 is connected to R6 and R4 is connected to R7. Last, we have an external-facing router called R1 that's connected to R2 and another external-facing router called R5 that's connected to R4. If you've drawn this topology out, ours resembles a hexagon with two arms sticking out from the top-left and top-right points.
In this example, we're imagining that AS 200 is our own company's autonomous system. Hopefully having a visual sense of our hypothetical topology helps when it comes to conceptualizing what's happening when Border Gateway Protocol moves traffic through our company's autonomous system.
How to Advertise a Default Route in BGP
Much of what BGP does for route selection happens passively. In a total vacuum, it might be simple enough for the owner of R2 to instruct a default route into our company's AS 200. But there are potential problems and hang-ups that can happen when an exterior router tries to navigate our particular pathways. We'll explore some of those problems here.
Assuming we have control of the R2 device in our topology, it's relatively simple to tell it to send in a default route into our topology with BGP. In R2's console, type:
This initializes configuration, next is going into BGP configuration specifically. To do that, type:
router bgp 100
The next step is to specify the neighbor we're interested in advertising the default route to. Doing that requires the IP address of the neighbor in question. In our case it's 10.26.26.6. We combine that with the default-originate command. All combined, type:
neighbor 10.26.26.6 default-originate
The default-originate command does have a route-map option that can come at the very end of the command. That option allows you to specify conditions that must exist before the default route can be originated, but depending on your circumstances, you won't need it. In our case, we don't, so we're going to leave it out entirely.
Now that we've made that configuration, what we should see on our R6 device. Remember, R6 is the first router in our company's AS 200, and it's the IP address we supplied above is that default route. But that's not particularly interesting for us. What we'd rather show is how BGP can be foiled by configurations on routers. So we're going to set up that scenario and demonstrate how to resolve it.
An Overview of How to Advertise a Default Route in BGP [VIDEO]
In this video, Anthony Sequeira explains Border Gateway Protocol (BGP). Anthony covers how to distribute a default route using BGP and discusses potential issues to consider and solve.
How to Fix Static Routes Screwing Up Your Default Routes
Having static routes on your devices can make setting default routes hard. To show that, we'll head to our R6 device and type:
show ip route
In our case, what this shows is that despite having advertised a default route from the neighboring device and AS, we're not getting the route we were hoping for. Instead, we see that there's already a static route configured on this device through the IP route command. If you've already assigned such a route, you wouldn't see the default route we'd expected to. To check for that, type:
show ip bgp
This displays a BGP table for that device, and at least in our case, the route we were expecting to see isn't there. This is a classic error in BGP, it's known as a RIB failure. A Routing Information-Based failure or RIB failure happens when a BGP route isn't preferred because the locally configured default route, the static route, has precedence. The administrative distance of a route is its dependability rating, and has to do with where the device learned the route from and where the destination is.
In our case, we have a static route on R6. Although our device learned R2's advertised route, the device failed to install it into the routing table because of the lower administrative distance the static route has compared to the learned external route.
The solution to this RIB failure is to go into R6 and get rid of the static route that's in place. To do that, navigate to R6's console and type:
no ip route 0.0.0.0 0.0.0.0 10.26.26.2
Since the next hop was that .2 device (R2 in our topology), giving those quad-0s negates the default route on the device that was having the RIB failure.
Now that the device's static routes are cleared, we can re-run our earlier commands by typing:
show ip route
This time, we see that the BGP default route is inserted and proliferated throughout the topology. What this should hopefully demonstrate is that advertising BGP routes is quite simple, but it can also be easily overridden by local policies. And one to watch out for in particular is the classic administrative distance RIB failure issue when you're working with default routes in BGP.
Filtering Prefixes when Using Default Routes
There's another aspect to be aware of, another danger to a topology's default routes. Once these steps are completed, R2 will be faithfully sending the default route information as we just saw. And once it's received by our organization's AS 200, that default routing information does get proliferated onward, just like we'd want it to be.
But remember the R1 device in our scenario, it's the outward-facing device that's connected to R2, which is, in turn, connected to R6 and our autonomous system. It's important to keep in mind that the prefixes that are being advertised from the R1 device are going to be advertised as well.
What that can mean for your topology is that many times, when a default route is being used inside of BGP, you'll need to do some kind of filtering on more specific prefixes. There are a number of solutions to this – for instance, a distributed list would be one way to get that filtering done. We've run out of space to cover all the filtering approaches that are possible with BGP, but stay tuned for more details on that in later blog posts.
Obviously, this is only one small part of the bigger picture that is Border Gateway Protocol. Advertising a default route and undoing a static route is important, but hardly everything a network administrator needs to know in order to maintain enterprise networks and autonomous systems. If you're looking for a more in-depth understanding of BGP configuration, try our BGP training.