Thursday, February 3, 2011

BGP Conditional Default Route

Pretty much everyone knows that you can inject a default route to a neighbor in BGP by using a command like so:
router bgp 300
neighbor 164.18.46.8 default-originate

This will unconditionally inject a default route to that neighbor.  Note: They will still get all the other BGP routes as the router originating this command will not suppress the other routes just b/c it is injecting a default to them.  To conditionally set a default route you can use the route-map option at the end of this neighbor command.  See below:
router bgp 300
neighbor 164.18.48.8 default-originate route-map SW2-DEFAULT
neighbor 164.19.26.6 default-originate route-map R6-DEFAULT

ip access-list standard BGP-SW2
permit 192.168.2.0

ip access-list extended BGP-R6
permit ip host 192.168.2.0 host 255.255.255.0

route-map SW2-DEFAULT permit 10
match ip address name BGP-SW2

route-map R6-DEFAULT permit 10
match ip address name BGP-R6

So as you can see here the big difference is the access-lists right?  One is a standard ACL, the other is an extended ACL.  So whats the difference?  Well the first one will allow the default to originate if there in an entry in the routing table that will match that route, no matter the mask (192/8 , 192.168/16, 192.168.2/24) ...all would work.  The extended acl actually defines a mask, a /24 to be picky in this case. 

This is just something I ran into and found interesting when I was trying to filter using that route-map option originally.  I looked it up, and found it here BGP REFERENCE ...strange that I never used this enough to remember it in my CCIP studies!

No comments:

Post a Comment