cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1909
Views
0
Helpful
3
Replies

Path Manipulation BGP

grew00028
Level 1
Level 1

2020-09-21 22_24_34-Window.jpg

 

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

 

 

 

 

 

 

3 Replies 3

pmckenzie
Level 3
Level 3

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.

https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/213285-understand-the-importance-of-bgp-weight.html 

There are worlds out there where the sky is burning, where the sea's asleep and the rivers dream, people made of smoke and cities made of song. Somewhere there's danger, somewhere there's injustice and somewhere else the tea is getting cold" Dr Who

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.

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.

 

 

Review Cisco Networking for a $25 gift card