How to make OSPF routes not more important than "connected routes"

Ondrej Zajicek santiago at crfreenet.org
Sat Nov 13 17:21:33 CET 2021


On Sat, Nov 13, 2021 at 08:03:52AM +0100, Lukas Haase wrote:
> Hello,
> 
> This is probably fairly trivial but how can I tell bird (or Linux) that "connected routes" should have higher precedence than the routes from OSPF (even if they may be more specific)?
> 
> I have the following issue: I have a bunch of connected routers, connected via /31 links. There is also a loop.
> 
> Now a Mikrotik OSPF node sends me a route (that it can reach) for a station that's actually directly connected. Unfortunately the system takes the OSPF route.

Hello

That is AFAIK not possible. More specific routes are always preferred,
regardless of metrics, or direct-connectness. You can only filter out
such more specific routes, so they are ignored. Or you can configure
links to use /32 PtP networks intead of /31. Or ensure that announced
/32 host addresses are distinct from network addresses.


> But of course, the directly connected interface route should always be preferred.

That is ab interesting question regardless of this specific issue. I would say that
in OSPF network when an indirect path has shorter metric than a direct path, then
the indirect path should be used. It is possible that different routers have
different cost for the same network, so in same cases it may make sense to
deliver packet to a host in that network through different router indirectly.

But i can see that some could argue that scope trumps metric, and
direct > intra-area > inter-area > inter-AS.


> Example:
> 
> # birdc show ospf neigh
> BIRD 1.6.8 ready.
> edge1:
> Router ID       Pri          State      DTime   Interface  Router IP
> 203.0.113.193      1     Full/PtP        00:36   gre1      203.0.113.255
> 203.0.113.194      1     Full/PtP        00:37   wg1       203.0.113.225
> 
> # birdc show route | grep '203.0.113.22\(4\|5\)'
> 203.0.113.224/32    dev wg1 [edge1 2021-11-12] * I (150/0) [192.168.164.183]
> 203.0.113.225/32    via 203.0.113.255 on gre1 [edge1 06:18:20] * I (150/110) [203.0.113.194]

> Here we can see that to reach 203.0.113.225 (my desired endpoint), there are two routes: 203.0.113.224/31 which is the "connected route" set up automatically by Linux when I create the interface.
> 
> And "203.0.113.225 via 203.0.113.255" which I receive via OSPF from a Mikrotik router which can also see this node.

But why there is no "203.0.113.225/32 via 203.0.113.225 on wg1" received via OSPF?


-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."


More information about the Bird-users mailing list