10-23-2017 01:28 PM - edited 03-05-2019 09:21 AM
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.
Solved! Go to Solution.
10-23-2017 02:34 PM
Hi Martin,
router bgp 100
bgp log-neighbor-changesnetwork 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
10-23-2017 02:34 PM
Hi Martin,
router bgp 100
bgp log-neighbor-changesnetwork 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
10-23-2017 04:15 PM - edited 10-23-2017 04:18 PM
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.
10-24-2017 12:15 PM
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
10-24-2017 12:20 PM
10-24-2017 12:41 PM
Great! i gonna try it. Thanks for all.
Have a nice day!
Martín
10-24-2017 12:55 PM - edited 10-24-2017 12:56 PM
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
:-)
10-24-2017 12:57 PM
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
10-24-2017 01:31 PM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide