08-09-2016 04:39 PM - edited 03-05-2019 04:28 AM
I have a router connected to two MPLS providers and I'm learning how to use local preference so traffic is preferred by Comcast MPLS over the second MPLS (AS 4321). I have the configuration below on the router but it won't match until I remove the regular expressions and just use 1234 to match the AS #. I tried ^1234$ and ^$ and _1234$ but only 1234 works. Not complaining but not sure why the regular expression doesn't work.
Appreciate any help.
Jeff
router bgp 30
no synchronization
bgp log-neighbor-changes
network 10.3.3.0 mask 255.255.255.0
neighbor 172.16.3.2 remote-as 4321
neighbor 172.16.3.2 route-map NO-TRANSIT-AS out
neighbor 192.168.3.2 remote-as 1234
neighbor 192.168.3.2 route-map PREFER-Comcast in
neighbor 192.168.3.2 route-map NO-TRANSIT-AS out
no auto-summary
ip as-path access-list 1 permit ^1234$
ip as-path access-list 10 permit ^$
!
!
route-map NO-TRANSIT-AS permit 10
match as-path 10
!
route-map PREFER-Comcast permit 10
match as-path 1
set local-preference 200
!
route-map PREFER-Comcast permit 20
Solved! Go to Solution.
08-10-2016 11:17 AM
Hi Jeff,
The document you have been studying is doing a somewhat different selection and a different logic.
What they do on Page 52 is this:
Your situation seems to be different - you're not matching the preferred routes based on where they were originated but rather which provider they are reachable through.
In fact, and I allowed to let myself get confused as well - note that we are applying a route-map with a regexp of ^1234_ to BGP neighbor 192.168.3.2 that is in AS 1234. But naturally, every route advertised by this neighbor is going to start with 1234 in its AS_PATH! In other words, the whole regexp in the route-map PREFER-Comcast is not necessary at all because it will match any route advertised from 192.168.3.2.
So the easiest way of increasing the local preference of all routes received from 192.168.3.2 is to have a very simple route-map as follows:
route-map PREFER-Comcast permit 10
set local-preference 200
!
router bgp 30
neighbor 192.168.3.2 route-map PREFER-Comcast in
Would this make sense?
Best regards,
Peter
08-09-2016 08:27 PM
Hi Jeff,
If you want to prefer paths that are coming from Comcast, then - assuming that 1234 is Comcast's ASN - all paths from Comcast will have 1234 as their first ASN in the AS_PATH, but there can be an arbitrary number of other ASNs following. Your regexp ^1234$ matches only paths that are local to Comcast and are received directly from it; the regexp _1234$ matches only paths that are local to Comcast and are received either directly or through any intermediary AS.
Correctly, the regexp should be ^1234_
Would you mind trying that out?
Best regards,
Peter
08-10-2016 05:12 AM
Peter:
^1234_ worked. I'm a little confused as the Cisco MPLS WAN Design Guide (see link below) has _1234$ as the reg exp for the preferred MPLS. I followed the guide but their reg exp doesn't work.
Appreciate the help.
Jeff
fhttp://www.cisco.com/c/dam/en/us/td/docs/solutions/CVD/Aug2014/CVD-MPLSWANDesignGuide-AUG14.pdf
08-10-2016 11:17 AM
Hi Jeff,
The document you have been studying is doing a somewhat different selection and a different logic.
What they do on Page 52 is this:
Your situation seems to be different - you're not matching the preferred routes based on where they were originated but rather which provider they are reachable through.
In fact, and I allowed to let myself get confused as well - note that we are applying a route-map with a regexp of ^1234_ to BGP neighbor 192.168.3.2 that is in AS 1234. But naturally, every route advertised by this neighbor is going to start with 1234 in its AS_PATH! In other words, the whole regexp in the route-map PREFER-Comcast is not necessary at all because it will match any route advertised from 192.168.3.2.
So the easiest way of increasing the local preference of all routes received from 192.168.3.2 is to have a very simple route-map as follows:
route-map PREFER-Comcast permit 10
set local-preference 200
!
router bgp 30
neighbor 192.168.3.2 route-map PREFER-Comcast in
Would this make sense?
Best regards,
Peter
08-12-2016 07:58 AM
Peter:
The route map without the reg exp you works fine and makes perfect sense. I appreciate your time to help me.
Thanks again.
Jeff
08-13-2016 12:34 AM
Hi Jeff,
It has been a pleasure.
Best regards,
Peter
10-12-2016 06:37 AM
Peter, once again thanks for your help.
After testing this solution for a while one problem is if MPLS at a site on AS 1234 goes down other sites will still use the preferred carrier causing one site to be transient with a longer AS path. Is there a BGP config that would prefer carrier AS 1234 but if a link on that carrier goes down then the sites will use carrier 4321? Attached is a diagram of our MPLS network.
Thank you for any help.
Jeff
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