#

Saturday, December 22, 2018

Conditional Default Route Injection in BGP

Default routes can be injected into BGP in one of 3 ways.

1. By network command
2. By redistribute command + default-information originate command
3. By neighbor <neighbor-id> default-originate sub command

From all the above 3 methods, the last one does not add a default route to the local BGP table. Instead it will advertise a default route to a neighbor even without having a default route in it's IP routing table and when it is configured with a route-map, we can advertise the default route with a condition such as an availability of a particular route in the IP routing table.

We can check for the availability of a directly connected link via this method and advertise a default route to a neighbor until the route is in IP routing table. In this post I am checking for the availability of the default route in IP routing table and advertise a default to a neighbor. Here is how to do that..

Create a prefix list to match the default route;
R(config)#ip prefix-list DEFAULT seq 5 permit 0.0.0.0/0

Create a route map with the prefix list;
R(config)#route-map CHECK-DEFAULT permit 10
R(config-route-map)#match ip address prefix-list DEFAULT

Configure neighbor with default-originate & route map
R(config)#router bgp 65001
R(config-router)#bgp log-neighbor-changes
R(config-router)#neighbor 192.168.12.2 remote-as 65002
R(config-router)#neighbor 192.168.12.2 default-originate route-map CHECK-DEFAULT

Note that if you are going to use an access-list to achieve the above result, following simple ACL can be used..

R(config)#ip access-list standard DEFAULT
R(config)#permit any

No comments:

Post a Comment