How to make local IPs prefered over BGP routes

Hello everyone,

I am using BGP internally to distribute routes.

when i have my local ip
dst-address 10.0.0.0/16 reachable on ether1

and i got bgp route
dst-address 10.0.0.0/24

why mikrotik prefere bgp route with 10.0.0.0/24 over my local address ?
how can i resolve it, and make mikrotik always prefere local address even with small bgp subnet mask

THANKS

hello,

so, your local lan routes goes out of local router - before reaching its local destination?

you might want to read this guide :

https://wiki.mikrotik.com/wiki/Manual:BGP_Best_Path_Selection_Algorithm

The guide linked in the previous post is very useful and I recommend reading it.

In a nutshell this seems to be the issue:

10.0.0.0/24 is more specific than 10.0.0.0/16 so traffic needing to to go to 10.0.0.0/24 will take the route advertised via BGP rather than the connected route.

To resolve the issue, you might want to take a look at your address scheme.