07-30-2013 04:13 PM - edited 03-07-2019 02:40 PM
Hi,
hopefully an easy question, but when one uses the "match community" command in a route-map, does the following work :
route-map bgp permit 1
match community 65000:2
or does it have to be:
ip community-list 20 permit 65000:2
!
route-map bgp permit 1
match community 20
the platform is SUP2T using IOS 15.0.1SY4
Many Thanks,
Guy
Solved! Go to Solution.
07-30-2013 04:18 PM
It has to be a community-list, otherwise it will not work.
Best Regards,
Jose.
07-30-2013 04:20 PM
Hi Guy,
I believe that only the second option is supported, i.e. first define a community ACL and then refer to it in a route-map.
Router(config-route-map)#match community ?
<1-99> Community-list number (standard)
<100-500> Community-list number (expanded)
WORD Community-list name
Best regards,
Peter
07-30-2013 04:47 PM
Peter,
you are right. The problem is that, if by mistake you add the community directly, IOS will not give you an error message as it will believe that this is a community-list that it really does not exist. I have seen this mistake a couple of times in production networks.
Of course, this will be depend of what community number you are using, but for those in-between 1 and 500 or in the format with the two colons, IOS will not give you any error message as it will believe that they are community-lists. For the others, it gives this message:
R7(config-route-map)#match community 501
% Community name cannot have all digits
R7(config-route-map)#match community 65000
% Community name cannot have all digits
Best Regards,
Jose.
07-30-2013 04:18 PM
It has to be a community-list, otherwise it will not work.
Best Regards,
Jose.
07-30-2013 04:20 PM
Hi Guy,
I believe that only the second option is supported, i.e. first define a community ACL and then refer to it in a route-map.
Router(config-route-map)#match community ?
<1-99> Community-list number (standard)
<100-500> Community-list number (expanded)
WORD Community-list name
Best regards,
Peter
07-30-2013 04:47 PM
Peter,
you are right. The problem is that, if by mistake you add the community directly, IOS will not give you an error message as it will believe that this is a community-list that it really does not exist. I have seen this mistake a couple of times in production networks.
Of course, this will be depend of what community number you are using, but for those in-between 1 and 500 or in the format with the two colons, IOS will not give you any error message as it will believe that they are community-lists. For the others, it gives this message:
R7(config-route-map)#match community 501
% Community name cannot have all digits
R7(config-route-map)#match community 65000
% Community name cannot have all digits
Best Regards,
Jose.
07-30-2013 10:40 PM
Thanks Peter, Jose.
I also always used the community list, but noticed this other config on another network
Regardsn
Guy
12-21-2018 06:16 AM
Great tip! This fixed it. Here's what I went with:
route-map BGP-OUT-RM, permit, sequence 10 Match clauses: community (community-list filter): 100 Set clauses: as-path prepend 65218 65218 65218 65218 Policy routing matches: 0 packets, 0 bytes route-map BGP-OUT-RM, permit, sequence 20 Match clauses: community (community-list filter): 200 Set clauses: Policy routing matches: 0 packets, 0 bytes route-map OSPF-to-BGP-RM, permit, sequence 10 Match clauses: tag 100 Set clauses: community 100 Policy routing matches: 0 packets, 0 bytes route-map OSPF-to-BGP-RM, permit, sequence 20 Match clauses: route-type internal Set clauses: community 200 Policy routing matches: 0 packets, 0 bytes router bgp 65218 no synchronization bgp log-neighbor-changes redistribute connected redistribute ospf 20 route-map OSPF-to-BGP-RM neighbor 10.3.1.78 remote-as 13979 neighbor 10.3.1.78 route-map BGP-OUT-RM out no auto-summary
ip community-list 100 permit 100
ip community-list 200 permit 200
Now the receiving router receives those routes w/ the correct AS-Path prepending, allowing it to use the most optimal route to given subnets:
ATT-WAN#show ip bgp nei 10.3.1.77 received-routes BGP table version is 19, local router ID is 10.3.1.158 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * 10.250.1.0/24 10.3.1.77 2 0 65218 ? * 10.254.255.32/30 10.3.1.77 4 0 65218 65218 65218 65218 65218 ? * 10.254.255.36/30 10.3.1.77 4 0 65218 65218 65218 65218 65218 ? * 10.254.255.40/30 10.3.1.77 3 0 65218 65218 65218 65218 65218 ? * 10.254.255.44/30 10.3.1.77 3 0 65218 65218 65218 65218 65218 ? * 10.254.255.200/30 10.3.1.77 2 0 65218 65218 65218 65218 65218 ? * 10.254.255.204/30 10.3.1.77 2 0 65218 65218 65218 65218 65218 ? * 10.254.255.208/30 10.3.1.77 12 0 65218 65218 65218 65218 65218 ? Network Next Hop Metric LocPrf Weight Path Total number of prefixes 8
The project I was working on was how to optimize routing between my organization's Datacenter and DR site, the later of which is starting to host production applications, and our remote sites via our MPLS AVPN cloud. I don't have access to the AVPN PE router (and the ISP is a huge pain) that sits in a separate ASN, so I needed a way to influence the PE router's route selection so that it passes on those routes to our remote sites.
I was also trying to avoid a prefix list or an ACL because someone has to keep those up-to-date or we get suboptimal routing again. If I could use tags, I could pick a choke-point between the Datacenter and DR site (that communicate using OSPF on a back-door connection). On that choke-point I would split our OSPF instance, applying route tags when redistributing between OSPF instances. Then, the CE WAN routers could see those tags via their OSPF instance and, when redistributing into their BGP instance, apply community values. Finally, when advertising routes to their BGP neighbors, the WAN routers could prepend the AS-Path (or not) based on those community values.
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