4

I am trying to set the local preference of certain routes based on the community string. I created the community list and confirmed it is working by checking the routes reported matching the community-list:

# show policy community-list
 community-list 100 {
     rule 10 {
         action permit
         regex ###:####
     }
 }

Then I used that community list in the route-map:

# show policy route-map default-import
 rule 20 {
     action permit
 }
 rule 21 {
     action permit
     match {
         community {
             community-list 100
         }
     }
     set {
         local-preference 50
     }
 }

However, on committing and resetting the BGP session, I do not see any local preference adjustments when I run show ip bgp. Am I missing something in my config?

OS: VyOS 1.05

3
  • 1
    You might want to mention what device, OS and version you are working on. My guess is that rule 20 is catching everything and exiting your route-map before hitting your condition, but I don't have experience on Juniper (guessing from syntax).
    – cpt_fink
    Jan 21, 2015 at 2:03
  • @cpt_fink. You were right so you can submit that as an answer if you'd like. Even though you didn't know my device. It looks like defining it as a rule before rule 20 is what was needed. I didn't realize it would only match against one rule. I guess in the future I need to define the most specific rules at the beginning. P.S. this device is VyOS. I figured it would be pretty similar to Cisco/Juniper but there aren't many tags available.
    – Devon
    Jan 21, 2015 at 2:18
  • I'll post as an answer. Could you edit your post to include that it is VyOS and what version, just so future searchers have an easier time?
    – cpt_fink
    Jan 21, 2015 at 3:25

1 Answer 1

9

Your issue was caused by the generic permit (no match clause) attached to rule 20 of the default-import route-map. Route-maps usually act like ACL's and stop processing after the first match.

In Cisco-land you can use the continue keyword to continue evaluating the route-map instead of exiting at the first match. I wasn't able to find VyOS documentation about this, so I don't know if it exists in your OS.

3
  • Thanks again. continue and call exist in the route-map rules for VyOS after further inspection.
    – Devon
    Jan 21, 2015 at 4:39
  • You could also reverse the order, swapping 20 and 21, so it checks for the community and makes the alterations first, and routes that don't match the community are passed as unaltered.
    – nicotine
    Jan 23, 2015 at 23:23
  • Very true... I wouldn't recommend using continue unless you need it.
    – cpt_fink
    Jan 24, 2015 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.