You have a few options here.
If you prefix allows, the best option is the advertise smaller prefixes to the preferred ISP and larger to the backup one by simply cutting your prefix in half. For example
#.#.#.#/20 with two prefixes to the primary
#.#.#.#/19 with the full single prefix to the secondary
This will always work and cannot be easily over ridden by the ISP.
If you only have /24 so cannot split prefixes, your next best option is to lookup the community options with your backup ISP provider. Many ISP provide a list of BGP communities that you can use to influence their usage of your routes. What you want is the community to lower the local preference of your advertisement. When you add this to the route the secondary ISP will consider your advertisement a backup route but use the route it eventually gets from your other ISP as primary.
Your last options is to add one or two additional copies of your AS number to the route you advertise to the backup ISP. The number of AS is used to prefer one route over another but comes later in the process. And many ISP no longer use this criteria but manage traffic more explicitly. So it has less effect.
------------------------------
Steve Puluka BSEET - Juniper Ambassador
IP Architect - DQE Communications Pittsburgh, PA (Metro Ethernet & ISP)
http://puluka.com/home------------------------------
Original Message:
Sent: 09-27-2021 04:54
From: VIKAS BHARTI
Subject: Route Preference in BGP with two AS number
We are using BGP with two different ISPs(Different AS number) in MX-104 router . My question is how to give higher preference to one AS number over other, so that my data will always flows with my preferred ISP and in case if preferred route is down it automatically shifts to less preferred path..
------------------------------
VIKAS BHARTI
------------------------------