09-21-2020 07:42 PM
I have AS 100 with 3 routers (R1, R2 and R3) running OSPF and IBGP. R2 Being route reflector
R1 is connected to R4 (EBGP) === R4 is advertising 11.0.0.1/8
R2 is connected to R5 (EBGP) === R5 is advertising 11.0.0.1/16
R3 is connected to R6 (EBGP) === R6 is advertising 11.0.0.1/24
Right now traffic to 11.0.0.1 exist AS 100 from R3 due to longest prefix match.
How to do path manipulation so that all the traffic from AS 100 for 11.0.0.1 exists from R1.
==============================================================================================
R1#sh run | s bgp
router bgp 100
bgp router-id 1.1.1.1
bgp log-neighbor-changes
bgp default local-preference 1000
network 1.1.1.1 mask 255.255.255.255
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
neighbor 2.2.2.2 next-hop-self
neighbor 10.1.1.2 remote-as 400
neighbor 10.1.1.2 route-map MY_ROUTES out
R1#
R1#
R1#sh run | s route-map
neighbor 10.1.1.2 route-map MY_ROUTES out
route-map MY_ROUTES permit 10
match as-path 1
R1#
R1#
R1#sh run | s as-path
ip as-path access-list 1 permit ^$
match as-path 1
==============================================================================================
R2#sh run | s bgp
router bgp 100
bgp router-id 2.2.2.2
bgp log-neighbor-changes
network 2.2.2.2 mask 255.255.255.255
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback0
neighbor 1.1.1.1 route-reflector-client
neighbor 1.1.1.1 next-hop-self
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 route-reflector-client
neighbor 3.3.3.3 next-hop-self
neighbor 10.1.2.2 remote-as 500
neighbor 10.1.2.2 route-map MY_ROUTES out
R2#
R2#
R2#sh run | s route-map
ip policy route-map PREFIX
neighbor 10.1.2.2 route-map MY_ROUTES out
route-map MY_ROUTES permit 10
match as-path 1
R2#
R2#
R2#sh run | s as-path
ip as-path access-list 1 permit ^$
match as-path 1
==============================================================================================
R3#sh run | s bgp
router bgp 100
bgp router-id 3.3.3.3
bgp log-neighbor-changes
network 3.3.3.3 mask 255.255.255.255
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
neighbor 2.2.2.2 next-hop-self
neighbor 10.1.3.2 remote-as 600
neighbor 10.1.3.2 route-map MY_ROUTES out
R3#
R3#
R3#sh run | s route-map
neighbor 10.1.3.2 route-map MY_ROUTES out
route-map CCIE permit 10
match ip address prefix-list 1
route-map MY_ROUTES permit 10
match as-path 1
R3#
R3#
R3#sh run | s as-path
ip as-path access-list 1 permit ^$
match as-path 1
09-21-2020 10:02 PM
If you are using Cisco routers the easiest method is to set the weight of path to R1 as highest.
Weight is zero by default except for routes that originate from router itself such as your Loopback addresses.
(sh ip bgp will show you weights)
Eg R2(config)#neighbor 1.1.1.1 remote-as 100
R2(config)#neighbor 1.1.1.1 weight 200
Weight path attribute is the first path attribute BGP checks in the election of the best path in the BGP table.
09-22-2020 06:35 AM
Weight or any other BGP path attribute will not work in this case. Before hitting the BGP attributes its hitting the normal Route selection process which is matching the longest prefix.
10-01-2020 10:24 AM
Even if its cisco router and I get same prefixes from all three ISP's, weight is not a good option, bcz weight is local to router, it does not get advertised within the AS. R2 and R3 will never know that R1 is the preferred exit path as weight is applied on R1, only R1 will be able to take that path.
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