How to advertise networks in BGP

Hello Hussein,

I’m afraid you can’t do this. With BGP, the network command adds something to the global BGP table and then you can use route-maps to decide if you want to advertise something or not to your neighbors.

What exactly are you trying to do? If you want something where you don’t advertise anything to a neighbor unless you configure it to do so, then you still could use a route-map with some regular expressions. For example, let’s say you don’t want to advertise anything by default that you added to the BGP table then you can use a route-map with a regular expression like this:

R1(config)#ip as-path access-list 1 permit ^$ 

R1(config)#ip prefix-list THESE_PREFIXES permit 1.1.1.1/32

R1(config)#route-map TO_R2 permit 10
R1(config-route-map)#match ip address prefix-list THESE_PREFIXES

R1(config)#route-map TO_R2 deny 65535
R1(config-route-map)#match as-path 1

You can also get pretty creative with the BGP communities.

PS - It is possible to attach a route-map to a network command btw, but it can only be used to change the attributes of the network you advertise.

1 Like