Community discussions

MikroTik App
 
AlohaSpark
newbie
Topic Author
Posts: 47
Joined: Wed Jun 16, 2021 10:39 pm

How to prefer OSPF routes over BGP routes

Fri Aug 25, 2023 8:37 am

Hello,

My main CHR has 3 main uplinks. Two are via direct BGP, and one is via another Mikrotik (which I have control over) on the ISP's premises. All 3 uplinks receive full table BGP.

The issue is, the two providers who are direct BGP peers have high latency. The one that's sharing routes via OSPF is much better.

How do I prefer the OSPF routes over the BGP routes? I have already tried setting the BGP routes' distance to 115 via an input filter (OSPF distance is 110 as shown below) yet traffic still goes through the BGP routes.

The network diagram is
   ISP 1       ISP 2                        ISP 3
 Full BGP     Full BGP                     Full BGP
       ▲        ▲                              ▲
       │        │                              │
       │        │                              │
       │        │                     ┌────────┴─────────┐
      ┌┴────────┴┐       OSPFv3       │ISP 3 On-Premises │
      │ Main CHR ◄────────────────────►     Mikrotik     │
      └────┬─────┘                    └──────────────────┘
           │
           │
           ▼
      My Computer
Route print
[admin@MikroTik] > /ipv6/route/print
Flags: D - dynamic; X - disabled, I - inactive, A - active; c - connect, s - static, r - rip, b - bgp, o - ospf, d - dhcp, v - vpn, m - modem, g - slaac, y - bgp-mpls-vpn; 
H - hw-offloaded; + - ecmp 
 #       DST-ADDRESS              GATEWAY                  DISTANCE
   DAo   ::/0                     fe80::7:3bff:fe29:257...      110
   DIgH  ::/0                     fe80::f652:14ff:fe0a:...        1
   DAc   ::/64                    eth3-LAN                        0
   DAb   2001::/32                2a0e:46c4:2d0d:1633::1        115
   DAb   2001:4:112::/48          2a0e:46c4:2d0d:1633::1        115
   DAb   2001:200::/32            2a0e:46c4:2d0d:1633::1        115
   DAb   2001:200:900::/40        2a0e:46c4:2d0d:1633::1        115
   DAb   2001:200:e00::/40        2a0e:46c4:2d0d:1633::1        115
   DAb   2001:200:c000::/35       2a0e:46c4:2d0d:1633::1        115
   DAb   2001:200:e000::/35       2a0e:46c4:2d0d:1633::1        115
   DAb   2001:218::/32            2a0e:46c4:2d0d:1633::1        115
   DAb   2001:218:2002::/48       2a0e:46c4:2d0d:1633::1        115

 
User avatar
nickshore
Long time Member
Long time Member
Posts: 521
Joined: Thu Mar 03, 2005 4:14 pm
Location: Suffolk, UK.
Contact:

Re: How to prefer OSPF routes over BGP routes

Fri Aug 25, 2023 5:41 pm

The closest subnet will be used for each route match, so if you don't have the equivalent routes in for ospf as well as BGP then only the BGP route will be used.

You could just filter routes and only accept a default route from each BGP peer, then there will be 3 default routes and you can control the distances as you wish.
 
User avatar
hknet
Member Candidate
Member Candidate
Posts: 126
Joined: Sun Jul 17, 2016 6:05 pm
Location: Vienna, Austria
Contact:

Re: How to prefer OSPF routes over BGP routes

Fri Aug 25, 2023 8:30 pm

Since you got BGP on all devices, why even bother running ospf (except for maybe IGP)?
You could attribute a better local preference to routes learned via your favorite router and prefer these routes.
hth, hk
 
AlohaSpark
newbie
Topic Author
Posts: 47
Joined: Wed Jun 16, 2021 10:39 pm

Re: How to prefer OSPF routes over BGP routes

Sat Aug 26, 2023 6:18 am

Since you got BGP on all devices, why even bother running ospf (except for maybe IGP)?
You could attribute a better local preference to routes learned via your favorite router and prefer these routes.
hth, hk
That's true. You're right.

I set up a static route and got rid of OSPF. All good now.

Who is online

Users browsing this forum: No registered users and 5 guests