Hi,
You can have an import BGP policy which sets higher local-preference for neighbor AS1. However, be sure to have a term accepting routes originating from AS2 and AS1 before the local-pref term. I've given one example below
policy-statement EBGP-IN {
term Peer-Originated {
from as-path [ AS1 AS2 ];
then accept;
}
term Local-Pref {
from neighbor 10.1.2.2;
then {
local-preference 110;
}
}
}
as-path AS1 ".* 65002";
as-path AS2 ".* 65003";
You need the first term because, as per the BGP route selection, local-preference will have higher precedence over AS-Path. Hence, if you do not have the "Peer-Originated" term, you may end up selecting AS1 for the routes originated by AS2 which will be sub-optimal and undesirable.
Also, make sure to have any discard related terms placed before the "Peer-Originated" term in your EBGP-IN policy.
Please accept the solution if it works 🙂
Rgds,
Pavan Kurapati
JNCIP-M