BGP not preferring shortest path

Hello

I have been troubleshooting an issue where some routes that have a shorter path are not being preferred over longer paths even though their weight, distance & local pref are the same.

Here is the route table for one route in particular with this issue

/ip route print detail where dst-address=119.9.0.0/18  
Flags: X - disabled, A - active, D - dynamic, C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 0 ADb  dst-address=119.9.0.0/18 gateway=2.2.2.2 gateway-status=2.2.2.2 reachable via  WAN1-vrrp 
        distance=20 scope=40 target-scope=10 routing-mark=national 
        bgp-as-path="4770,4770,9560,24130,58683,58683" bgp-origin=igp received-from=Peer1

 1  Db  dst-address=119.9.0.0/18 gateway=1.1.1.1 gateway-status=1.1.1.1
        reachable via  eth3-FC-vlan17 distance=20 scope=40 target-scope=10 
        routing-mark=national bgp-as-path="4826,58683,58683" bgp-origin=igp received-from=Peer2

You can see that the route from Peer2 is much shorter but is not marked active.

There may be a perfectly logical answer but I sure can’t see it. Does anyone have any ideas?

Regards
Brent

Both peers are using the same instance?

No they are both separate instances.

If peers are not using the same instance then best path selection algorithm is not used. Routes are selected by other means, distance or whichever route first appears.

Oh I didn’t realise that. So even different weights or local pref’s do not affect it? It is purely driven by the first route that appears?

Is there anything else that determines the route selection when different instances?

It is interpreted as regular route, just BGP best path algorithm is not used.
distance, scope, target scope are used.

I didn’t realise that but have now been able to resolve the issue by changing back to a single instance allowing the best path algorithm to work.

Thanks for your assistance.