cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4107
Views
45
Helpful
8
Replies

Configuring BGP exclude one subnetwork (network command) - ASR1002-X

martin.germano
Level 1
Level 1

 

  Hi all, i'm brand new on BGP, so i try to connect to another AS:

 

router bgp 100
 bgp log-neighbor-changes

 network 192.168.0.0 mask 255.255.0.0
 neighbor 10.0.8.254 remote-as 200

 

This seem work but i want to exclude for advertising one subnetwork (192.168.8.0/24 for example) for example.

 

is possible? How?

 

Thanks!

Martín.

 

 

 

1 Accepted Solution

Accepted Solutions

Hi Martin,


 

router bgp 100
 bgp log-neighbor-changes

 network 192.168.0.0 mask 255.255.0.0
 neighbor 10.0.8.254 remote-as 200

 

This seem work but i want to exclude for advertising one subnetwork (192.168.8.0/24 for example) for example.

 

is possible? How?

 

 


Yes, it is possible. One way of excluding is using prefix-lists and route-map. Here is an example.

 

ip prefix-list  EXCLUDE_ADDRESS seq 5 deny 192.168.8.0/24 le 32

ip prefix-list  EXCLUDE_ADDRESS seq10 permit 192.168.0.0/16 le 32

!

route-map ADVERTISE_TO_NEIGHBOR permit 10

match ip address prefix-list EXCLUDE_ADDRESS

!

 

router bgp AS_NUMBER

neighbor X.X.X.X route-map  ADVERTISE_TO_NEIGHBOR out

!

 

 

HTH,

Meheretab


HTH,
Meheretab

View solution in original post

8 Replies 8

Hi Martin,


 

router bgp 100
 bgp log-neighbor-changes

 network 192.168.0.0 mask 255.255.0.0
 neighbor 10.0.8.254 remote-as 200

 

This seem work but i want to exclude for advertising one subnetwork (192.168.8.0/24 for example) for example.

 

is possible? How?

 

 


Yes, it is possible. One way of excluding is using prefix-lists and route-map. Here is an example.

 

ip prefix-list  EXCLUDE_ADDRESS seq 5 deny 192.168.8.0/24 le 32

ip prefix-list  EXCLUDE_ADDRESS seq10 permit 192.168.0.0/16 le 32

!

route-map ADVERTISE_TO_NEIGHBOR permit 10

match ip address prefix-list EXCLUDE_ADDRESS

!

 

router bgp AS_NUMBER

neighbor X.X.X.X route-map  ADVERTISE_TO_NEIGHBOR out

!

 

 

HTH,

Meheretab


HTH,
Meheretab

Hi

Just adding to the previous post, if you have more networks to advertise, include this line:

ip prefix-list  EXCLUDE_ADDRESS seq 15 permit 0.0.0.0/0 le 32

The line will allow everything else. 




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<


  Thanks all for reply,

  Meheretab, i don't understand this:

I must to put this command:
  neighbor 10.0.8.254 remote-as 200

but instead if i make this command :
  neighbor 10.0.8.254 route-map  ADVERTISE_TO_NEIGHBOR out

I don't specify the AS. I'm right?

Thanks

 

 

 

Martin,

You will need both commands: the first one is to create a neighbor relationship and the latter one is to filter routes to a particular neighbor. The complete command should have something like this:

router bgp 100
neighbor 10.0.8.254 remote-as 200
neighbor 10.0.8.254 route-map ADVERTISE_TO_NEIGHBOR out
!

HTH,
Meheretab
HTH,
Meheretab

 

  Great! i gonna try it. Thanks for all.

 

Have a nice day!

Martín

Hi

Yes, this line: neighbor 10.0.8.254 remote-as 200  is mandatory because it is creating the BGP peering otherwise you will lose connection to that peer via BGP. Now this line is a complement for filtering: 

neighbor 10.0.8.254 route-map  ADVERTISE_TO_NEIGHBOR out

 

:-)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

Hello,

 

on a side note, and as an alternative to Julio's and Meheretab's solutions, you could also configure the below. The aggregate address by defaults sends all more specific networks, and the suppress map filters those specified in the respective route map...

 

router bgp 100
aggregate-address 192.168.0.0 255.255.0.0 suppress-map SUPPRESS
!
ip prefix-list SPECIFIC seq 5 permit 192.168.8.0/24
!
route-map SUPPRESS permit 10
match ip address prefix-list SPECIFIC

Hello

Caution should be taken when aggregating in BGP as it can lead to loops if you are not careful, due to the fact routing information can be lost on the advertised aggregate, As by default not only are you hiding the more specific routes you are also hiding AS numbers which are use in bgp to prevent loops!

 

res
Paul


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul
Review Cisco Networking for a $25 gift card