Tuesday, January 24, 2012

Advertising a default route using BGP IOS-XR

Sometimes you get requested to send a default route to a BGP neighbor instead of the entire routing table.  Whether it is because the user's equipment is not capable of the entire routing table or they just prefer a default route here is how you do it.

There are a couple of steps involved in sending a default route.  First you will need to issue the default-originate command on your BGP configuration.  This will instruct your router to send the default route in its advertisement to the selected neighbor.  Second you will need to tell you router not to advertise any other routes.

Here is the way that the default-originate command looks in IOS-XR:

router bgp xxxxx
neighbor 192.168.1.2
remote-as yyyyy
address-family ipv4 unicast
default-originate

xxxxx is your AS#, the neighbor statement will be the IP address of your neighbor, and yyyyy is your neighbor's AS#.

Assuming you have valid in and out route-policies defined you will now advertise a default route to your neighbor.

However, you will also be advertising other routes to your neighbor unless you restrict what you advertise.  If you only want to send the default route, then you will need to define the following route-policy:

route-policy drop-all
drop
end-policy

Now go back into your configuration for that neighbor and put in the following information:

router bgp xxxxx
neighbor 192.168.1.2
remote-as yyyyy
address-family ipv4 unicast
route-policy drop-all out

Even though you have defined to drop all routes your router will still honor the default-originate command and send the default route to your neighbor.  However it will strip all other routes from the advertisement.