cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
928
Views
0
Helpful
5
Replies

Local Preference

hassan_syed6
Level 1
Level 1

Hello,

Guys i have been reading about Local Preference. Wanted to clear my scenario. Input will be appreciated. Following is the

R1------------------------R2

| |

| |

| |

| |

R-3------------------------R-4

Sorry guys, LINES SHOULD BE SHOWING TO BE CONNECTED FROM R2 TO R4. Can't seem to create a straight line between R2 and R4

R-1 and R-2 both are running IBGP (Same AS).

R-3 and R-4 are running IBGP.

R-1 is connected to R-3 ( EBGP Connection)

R-2 is connected to R-4 ( EBGP connection).

Now the scenario is R-3 and R-4 both are sending the same set of Networks towards R1 and R2 respectively for eg (10.10.10.0/24). As the above connection is showing through EBGP.

What i want to acheive is What ever network R4 is sending towards R2. I want R-2 to access it going through R-1 and then to R-3. The networks coming from R-4 to R-2 i wanted to leave as it is with route-maps, just incase R-1 and R-2 connection goes down then R-2 has a way of knowing as to how to get to 10.10.10.0/24.

Let's say R-3 is sending 10.10.10.0/24 to R-1 and R-4 is sending 10.10.10.0/24 to R-2.

When i use Route-map on R-2, my local preference should be like this correct me if i am wrong

On R2#

route-map R1_to_R2_IN permit

match ip address R1_to_R2_IN

set local-preference 200 <---------------- This is correct or not

ip access-list standard R1_to_R2_IN

permit 10.10.10.0 0.0.0.255

route-map R2_to_R1_Out permit

match ip address R2_to_R1_Out

match ip address R2_to_R1_Out

permit 20.20.20.0 0.0.0.255

router bgp xxx

neigh x.x.x.x route-map R1_to_R2_IN

neigh x.x.x.x route-map R2_to_R1_Out

neigh x.x.x.x route-map R4_to_R2_IN

neigh x.x.x.x route-map R2_to_R4_Out

route-map R4_to_R2_IN permit

match ip address R4_to_R2_IN

ip access-list standard R4_to_R2_IN

permit 10.10.10.0 0.0.0.255

route-map R2_to_R4_Out permit

match ip address R2_to_R4_Out

ip access-list standard R2_to_R4_Out

permit 20.20.20.0 0.0.0.255

1 Accepted Solution

Accepted Solutions

Got it. You can use distribute list to control routing updates. Apply the distribute list outbound in advertisements to R2 on R1 and vice versa. You would need a config similar to this one.

R1:

router bgp xxx

neighbor R2 distribute-list 10 out

access-list 10 permit 10.10.10.0 0.0.0.255

HTH

Sundar

View solution in original post

5 Replies 5

As you may know, higher local preference is preferred. Hence, set the local preference to a higher value for Route(s) learnt from R3 on R1 and to a lower value on R2 for route(s) learnt from R4. Thus, all your IBGP/Internal routers would choose the path via R1-->R3 as the preferred path to get to 10.10.10.0/24. Local preference attribute is applicable only within an AS and therefore, you don't have to worry about filtering it on outbound updates to EBGP peers.

You need a configuration like the one noted below.

R1:

route-map from_R3 permit 10

match ip address 10

set local-preference 200

route-map from_R3 permit 20

access-list 10 permit 10.10.10.0 0.0.0.255

router bgp xxx

neighbor R3 route-map from_R3 in

R2:

route-map from_R4 permit 10

match ip address 10

set local-preference 150

route-map from_R4 permit 20

access-list 10 permit 10.10.10.0 0.0.0.255

router bgp xxx

neighbor R4 route-map from_R4 in

HTH

Sundar

Hello Sundar,

You have put the Local-preference 200 on Router # 1 so that 10.10.10.0/24 is prioritized from Router # 3

When i create a BGP neighbor on Router # 2 and Router # 1. Don't i have to define that 10.10.10.0/24 network is allowed to come in from Router 1 into Router 2 (IBGP connection) as mentioned in my notes above, and hosts on Router # 2 wants to access 10.10.10.0/24 then due to High local preference use the Router # 1.

Correct me if i am wrong

Regards,

Hassan

Hassan,

Unless, you are filtering any prefixes all routes should be advertised to all other BGP peers. I presume you don't want to filter anything you are learning from R1 and hence, there's no need to use route maps there. BGP table on R2 will have 2 paths for 10.10.10.0/24 and it will choose the one via R1 as the preferred path based on the higher local preference.

HTH

Sundar

Hello Sundar,

I do not want all routes to be advertised through R1 coming out of R2 and vice versa. That's why i am trying to control it through Route-maps.

Only those networks which R4 and R3 ( Same) are sending to R2 and R1 respectively. That's why i am putting a route-map on Router # 2 of networks which i wanted to learn from Router # 1 and saying if any hosts on Router # 2 wants to access this , then prefer this path. So in our example 10.10.10.0/24 i have put it in route-map in on Router # 2 coming from Router # 1 and have put a local-preference on it. So wouldn't this path will be prioritzed.

Thanks man...

Hassan

Got it. You can use distribute list to control routing updates. Apply the distribute list outbound in advertisements to R2 on R1 and vice versa. You would need a config similar to this one.

R1:

router bgp xxx

neighbor R2 distribute-list 10 out

access-list 10 permit 10.10.10.0 0.0.0.255

HTH

Sundar

Review Cisco Networking products for a $25 gift card