I'm running a MikroTik router (CCR1009) on RouterOS 7.18.2 and I'm trying to achieve a clean and reliable dual-uplink BGP setup with two providers:
ISP1 (Primary)
ISP2 (Backup)
I am receiving full Internet routing tables from both ISPs, plus a default route (0.0.0.0/0) from each.
I have BGP filters that set bgp-local-pref=200 for ISP1 and bgp-local-pref=100 for ISP2, aiming for ISP1 to always be the primary path.
However, RouterOS installs multiple BGP routes (ECMP) into the routing table even when local preference is different.
As a result, both ISP1 and ISP2 routes for the same prefixes are installed in FIB as ECMP paths, and traffic is randomly load-balanced between the two.
What I want:
Use ISP1 as the primary uplink for all traffic.
Use ISP2 only as backup (if ISP1 fails).
Prevent ECMP between ISP1 and ISP2 for identical prefixes.
Accept the default route from ISP1 only.
Keep full routing information for diagnostics and optional exports (like BGP-tools), if needed.
What I tried:
Set bgp-local-pref=200 for ISP1, bgp-local-pref=100 for ISP2.
Attempted to change distance, but RouterOS doesn't allow per-route distance modification for BGP.
Tried setting bgp-med, but it is read-only on input.
Found that RouterOS 7 automatically installs multiple "best" paths when attributes match, resulting in ECMP.
Tried select-only=yes on BGP template, but this command is not available in RouterOS 7.18.2.
Config (sanitized):
bashCopyEdit/routing bgp template
set default as=myasn disabled=no output.network=bgp-networks routing-table=main
add as=myasn disabled=no name=custom-template
/routing bgp connection
add name=ISP1-BGP remote.address=XXX.XXX.XXX.1 .as=XXXXX local.address=XXX.XXX.XXX.2 \
.role=ebgp input.filter=ISP1-IN output.filter=EXPORT-BGP routing-table=main
add name=ISP2-BGP remote.address=YYY.YYY.YYY.1 .as=YYYYY local.address=YYY.YYY.YYY.2 \
.role=ebgp input.filter=ISP2-IN output.filter=EXPORT-BGP routing-table=main
/routing filter rule
add chain=ISP1-IN rule="set bgp-local-pref=200; accept"
add chain=ISP2-IN rule="set bgp-local-pref=100; accept"
/ip route print where dst-address=\"0.0.0.0/0\"
Problem:
Even though I have configured different local preferences, I still get ECMP for most prefixes received from both ISPs.
Traffic randomly uses ISP1 or ISP2, instead of always preferring ISP1 unless ISP1 fails.
I know RouterOS 7 doesn't support changing distance for BGP routes and select-only is not an option at this RouterOS version.
Currently, I don't find a clean way to disable ECMP without manually rejecting duplicate prefixes or very complex policy routing.
Question:
How can I reliably prioritize all outbound traffic over ISP1?
How can I ensure default route is accepted from ISP1 only?
How can I cleanly avoid ECMP when receiving identical prefixes from two BGP peers?
Any help, workaround or example from MikroTik admins or advanced users would be really appreciated.