How to Configure BGP Local Preference Attribute


(Rene Molenaar) #1

This topic is to discuss the following lesson:


(system) #2

hy, i’m something problem in my network, can you help me.
example ;
- added 2 router James
- added 1 router CE
- AS 1 and AS 2
- Local preference : 700
- routing router CE to router James A and B with OSPF
how to configur Local preference in router Jim ?
My topology ;

router CE ==> router james A & B (AS :1) ======> (AS:2) router Jim & Jon

Thanks


(Rene Molenaar) #3

You can use a route-map like I did above. For example attach it to router Jim on inbound updates and set the local preference there.


(system) #4

i’ve done like route-map like did above, so ping & Lokal preference OK.
but I am having problems in the CE router, I use OSPF routing.

router-ce (config)#router ospf 10
router-ce (config-router)#
router-ce (config-router)#redistribute connected
% Only classful networks will be redistributed
R22(config-router)#

why Only classful networks will be redistributed ?

thanks


(system) #5

Hi Parwis,

By default, only classful networks are redistributed when using the “redistribute connected” command. You’ll need to include the “subnets” option if you want classless networks to be also redistributed. The command will be :

redistribute connected subnets


(system) #6

Hi,

What would be scenario if i apply

neighor 192.168.13.1 route-map LOCALPREF out instead of route-map LOCAL PREF in

Regards,
Vishal


(system) #7

Hi,

Waht ll be the effect if route map applied out direction.

neighbor 192.168.13.1 route-map LOCALPREF out insted of in

Regards,
Vishal


(Rene Molenaar) #8

Hi Vishal,

It’s possible to send local preference outbound to another IBGP neighbor. You can’t send it to EBGP neighbors since it’s not included in the BGP updates.

Rene


(system) #9

Hi Rene,
I was wondering why you configured OSPF. Is it not enough with internal BGP, adding the local networks to each bgp section in each router ? (Assuming the network topology is as simple as the example).


(Rene Molenaar) #10

Hi Diego,

Good question. Technically it is possible to configure this without OSPF, you’d have to advertise the 192.168.24.0/24 and 192.168.34.0/24 networks on router Jack in BGP so that Jim and John can reach each other.

It is a best practice so use an IGP to advertise the prefixes within the autonomous system so that’s why I used OSPF. It’s also a best practice to use loopback interfaces for IBGP (for failover) but that doesn’t apply to this topology since there are no backup links within AS2.

Rene


(Ben M) #11

You can use community strings to set local preference on remote EBGP peers


(Pankaj J) #12

Hi Rene

How do I achieve load balancing in BGP if I have multi homed link.


(Rene Molenaar) #13

Hi Pankaj,

BGP normally doesn’t do any load balancing but there are are some workarounds, for example you can try this:

router bgp 1
bgp bestpath as-path multipath-relax
address-family ipv4
maximum-paths 2

This will allow the router to use load balancing even though you have two different AS paths.

Rene


(Mohammad Taslim M) #14

Hi Rene,

Very nice explanations. BTW can you please change the names of routers. Instead of giving Jhon, Jim, James can you please re-write as simple as R1, R2 etc… I’m having difficulty to memorize these names

Thank you

Taslim


(Rene Molenaar) #15

Hi Taslim,

I’ll do this sometime, in all my newer lessons I always use R1, R2, SW1, SW2, ASA1, ASA2, etc.

Rene


(adil k) #16

Hi Rene,

what is the difference between LP And AS Path Prepend? Is configuring LP On one router sufficient enough to complete The PA?

And also you stated in a comment "Hi Vishal,

It’s possible to send local preference outbound to another IBGP neighbor. You can’t send it to EBGP neighbors since it’s not included in the BGP updates"

in your diagram Jacob is sending a LP OF 800 to James who is an EBGP Neighbor? Thanks


(adil k) #17

Or even Weight?


(Rene Molenaar) #18

Hi Adil,

Local preference is used to set the exit point for “your” AS. We use this on one of our routers on the edge of our network and advertise it to our iBGP routers. If you set a higher local preference on one edge router then it will be advertised to your iBGP routers and they will all prefer this exit path since the default local preference from the other router will be 0.

AS Path prepending is typically done from one AS to another AS. We can use this to inform the AS on the other side what path they “should” use to enter our network.

Weight only influences decisions on the local router, it’s not something that is advertised.

The arrow in the picture indicates the exit path that we use because of the higher local preference btw, not the advertisement :slight_smile:

Rene


(adil k) #19

Hi

Thank you for this, what about AS PATH PREPEND VS MED? (sorry for the pester)

Kind Regards


(Rene Molenaar) #20

Hi Adil,

Both can be used to inform the neighbor AS which path that they should use. There’s one difference why you might want to choose one over the other. Here’s an example:

Let’s say we have AS1-AS2-AS3. When you use AS path prepending on AS1 then AS2 and AS3 will both see the added AS numbers. When you use MED on AS1 then only AS2 will see it…AS2 will not forward the MED to AS3.

Rene