Today, let’s have a look at the third preferred path selection attribute; BGP routes originated locally. Lets take a look in particular to default routes originated locally. There are a couple of ways you can originate a default route for BGP; through the default-information originate command, with the network 0.0.0.0 command and with the neighbor <ip> default-originate command. But what are the differences between these different methods?
The default-information originate command requires that the default-route be learned using redistribution AND be in the routing table. This can be through an IGP or a static route.The network 0.0.0.0 command requires the default-route to be in the routing table. This can be again through an IGP or a static route. Finally, the neighbor <ip> default-originate command does not require a default route to be in the routing table but it will only originate a default-route for the neighboring router. What if these 3 commands are in place? What is the order of preference? Well I didn’t find any information on this so I set up a quick lab to test this:
Here’s the topology I created to test this: 3 routers in a full IBGP mesh.
The configuration is pretty simple. A peer-group was created with the loopback0 as source for the BGP neighborship and you can see BGP adjacency’s formed. Also, notice that I set the send-community attribute as I will use communities to identify each command to results.
In order to differentiate each command I created route-maps and assigned communities to each commands. Remember that communities do NOT alter the BGP decision making process so they are perfect to use as flags in order to identify the routing process of certain technologies. Community 1 will be used to identify the default-information originate command using redistribution.Community 2 will be used to identify the network 0.0.0.0 command and Community 3 the neighbor <ip> default-originate command. Let’s set the default-information originate command first:
A route is originated on R1, lets go check R3 to see if it has the default-route in its BGP routing tables:
The default route is being advertised and we can also see that the route is tagged with a Community of 1 on R3 and also on R2. Now lets try and use the neighbor <ip> default-originate command on R1 to advertise a default on R2. Let’s also look at R2 routing table afterwards:
As you can see, the community has changed to 3. That means that the neighbor <ip> default-originate command has precedence over the default-information originate command. Let’s continue with the testing and use the network 0.0.0.0 command and look at the results:
We can see that R3 Community is set to 2 now but R2 Community is still at 3. This means that the network 0.0.0.0 command takes precedence over the default-information originate command but the neighbor <ip> default-originate takes precedence over both of them.
When dealing with default-routes in BGP there are several commands that can be used. These commands have different requirements to be advertised and also a different order of selection. Here are the commands in decreasing order of precedence:
1. neighbor <ip> default-originate (does not require a default-route in routing table)
2. network 0.0.0.0 (requires default-route in routing table)
3. default-information originate (requires redistribution of the default-route)