When you use the local-preference command for a neighbor, that configures the router to set the local preference value of the routes
advertised to that neighbor, to the value that you specified. You want to set the local-preference of the received routes, so like some one else suggested you need to use an import policy.
Also, keep in mind that local-preference is only advertised to IBGP peers. Thus, in your scenario, the command is really doing nothing as your neighbor
172.16.13.129 is EBGP. If it was IBGP, you could configure this command on the neighbor, which will make it send the routes to you with local-preference 150, and your router would select the routes.
Regards,
------------------------------
Yasmin Lara
Juniper Ambassador
JNCIE-SP, JNCIE-ENT, JNCIE-DC, JNCIE-SEC
JNCDS-DC, JNCIA-DevOps, JNCIP-CLOUD, CCNP-ENT
------------------------------
Original Message:
Sent: 11-17-2020 09:27
From: Unknown User
Subject: BGP local preference configuration questions
I have one router which is connected to two remote routers in different AS, I configured local-preference for one of the peers to try to select that path as follows, but it does not result as I expected.
root@RP3# run show route 192.68.145.1
inet.0: 34 destinations, 62 routes (34 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
192.68.145.0/24 *[BGP/170] 00:00:31, MED 2, localpref 100
AS path: 64513 I, validation-state: unverified
> to 172.16.23.2 via ge-0/0/3.0
[BGP/170] 00:50:01, localpref 100
AS path: 64511 64513 I, validation-state: unverified
> to 172.16.13.129 via ge-0/0/2.0
[edit]
root@RP3# show protocols bgp | display set
set protocols bgp group eBGP type external
set protocols bgp group eBGP export exp2BGP
set protocols bgp group eBGP neighbor 172.16.23.2 peer-as 64513
set protocols bgp group eBGP neighbor 172.16.13.129 local-preference 150
set protocols bgp group eBGP neighbor 172.16.13.129 peer-as 64511
I like to select the path via 172.16.13.129, but it still selects 172.16.23.2, not know why. From the output the local preference is not changed.
But in the following output, it seems changed.
root@RP3# run show bgp neighbor
Peer: 172.16.13.129+29745 AS 64511 Local: 172.16.13.130+179 AS 64512
Type: External State: Established Flags: <Sync>
Last State: OpenConfirm Last Event: RecvKeepAlive
Last Error: Cease
Export: [ exp2BGP ]
Options: <Preference Localpref PeerAS Refresh>
Holdtime: 90 Preference: 170 Localpref: 150
Number of flaps: 1
Last flap event: Stop
Error: 'Cease' Sent: 1 Recv: 0
Peer ID: 172.16.13.129 Local ID: 33.33.33.33 Active Holdtime: 90
Keepalive Interval: 30 Group index: 1 Peer index: 0
BFD: disabled, down
Local Interface: ge-0/0/2.0
NLRI for restart configured on peer: inet-unicast
NLRI advertised by peer: inet-unicast
NLRI for this session: inet-unicast
Peer supports Refresh capability (2)
Stale routes from peer are kept for: 300
Peer does not support Restarter functionality
Peer does not support Receiver functionality
Peer supports 4 byte AS extension (peer-as 64511)
Peer does not support Addpath
Table inet.0 Bit: 10000
RIB State: BGP restart is complete
Send state: in sync
Active prefixes: 0
Received prefixes: 15
Accepted prefixes: 15
Suppressed due to damping: 0
Advertised prefixes: 25
Last traffic (seconds): Received 6 Sent 4 Checked 2
Input messages: Total 134 Updates 11 Refreshes 0 Octets 2970
Output messages: Total 136 Updates 8 Refreshes 0 Octets 3058
Output Queue[0]: 0
Any insights ?
thanks in advance !!