duplicate device routes on linux
Hello all, Here at $work we are using bird for OSPF at some 30 linux boxes. Works great. But there is a thing that confuses me: Let's have some simple linux box: # ip addr 1: lo: ...rest of loopback output 2: eth0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 86:37:65:15:fa:d9 brd ff:ff:ff:ff:ff:ff link-netns r2 inet 10.0.0.1/24 scope global eth0 valid_lft forever preferred_lft forever # ip route 10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.1 As you can see, there is single interface with single address, single device route automatically generated by kernel. Simple bird config: # cat bird.conf # BEGIN bird config router id 10.0.0.1; protocol device { scan time 3; } protocol kernel krnl4 { ipv4 { table master4; import all; export all; }; learn; } protocol ospf ospf1 { ipv4 { table master4; import all; export all; }; area 0.0.0.0 { stub no; interface "eth0" { stub yes; }; }; } # END bird config When I run bird with this configuration, it inserts another route: # ip route 10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.1 10.0.0.0/24 dev eth0 proto bird scope link metric 32 Is this expected/correct behaviour? Or should I somehow filter those device routes out? I want those device routes to be read by OSPF, of course, just not to output them back. What is the best way to get rid of them? Another unrelated question: When I run bird, it logs this: bird: KRT: Netlink strict checking failed, will scan all tables at once bird: Started Should I do something about that failed strict check? Is it important or only some info message I shouldn't worry about? Thank you ico
Yes, this is the default behavior. You can use RTS_DEVICE filter. Petr protocol kernel kernel4 {
ipv4 { import all; export where source != RTS_DEVICE; }; learn; scan time 300; }
protocol kernel kernel6 { ipv6 { import all; export where source != RTS_DEVICE; }; learn; scan time 300; }
po 20. 2. 2023 v 14:52 odesílatel ico <ico@petrzalka.net> napsal:
Hello all,
Here at $work we are using bird for OSPF at some 30 linux boxes. Works great. But there is a thing that confuses me:
Let's have some simple linux box:
# ip addr 1: lo: ...rest of loopback output 2: eth0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 86:37:65:15:fa:d9 brd ff:ff:ff:ff:ff:ff link-netns r2 inet 10.0.0.1/24 scope global eth0 valid_lft forever preferred_lft forever # ip route 10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.1
As you can see, there is single interface with single address, single device route automatically generated by kernel. Simple bird config:
# cat bird.conf # BEGIN bird config router id 10.0.0.1; protocol device { scan time 3; } protocol kernel krnl4 { ipv4 { table master4; import all; export all; }; learn; } protocol ospf ospf1 { ipv4 { table master4; import all; export all; }; area 0.0.0.0 { stub no; interface "eth0" { stub yes; }; }; } # END bird config
When I run bird with this configuration, it inserts another route:
# ip route 10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.1 10.0.0.0/24 dev eth0 proto bird scope link metric 32
Is this expected/correct behaviour? Or should I somehow filter those device routes out? I want those device routes to be read by OSPF, of course, just not to output them back. What is the best way to get rid of them?
Another unrelated question: When I run bird, it logs this:
bird: KRT: Netlink strict checking failed, will scan all tables at once bird: Started
Should I do something about that failed strict check? Is it important or only some info message I shouldn't worry about?
Thank you
ico
Thanks for answer. I tried this filter but the source is RTS_OSPF, not RTS_DEVICE. Also the proto is "ospf1". Can I somehow "mark" routes learned by OSPF from local kernel and filter on that mark? Or filter out routes without gw? I tried to filter out undefined gw "if !defined(gw)", that didn't work. (gw is defined, the stringified value is "::", but that doesn't match the gw in a condition). Thanks ico On 20. 2. 2023 15:01, Petr Boltík wrote:
Yes, this is the default behavior. You can use RTS_DEVICE filter.
Petr
|protocol kernel kernel4 { ipv4 { import all; export where source != RTS_DEVICE; }; learn; scan time 300; } protocol kernel kernel6 { ipv6 { import all; export where source != RTS_DEVICE; }; learn; scan time 300; }|
po 20. 2. 2023 v 14:52 odesílatel ico <ico@petrzalka.net <mailto:ico@petrzalka.net>> napsal:
Hello all,
Here at $work we are using bird for OSPF at some 30 linux boxes. Works great. But there is a thing that confuses me:
Let's have some simple linux box:
# ip addr 1: lo: ...rest of loopback output 2: eth0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 86:37:65:15:fa:d9 brd ff:ff:ff:ff:ff:ff link-netns r2 inet 10.0.0.1/24 <http://10.0.0.1/24> scope global eth0 valid_lft forever preferred_lft forever # ip route 10.0.0.0/24 <http://10.0.0.0/24> dev eth0 proto kernel scope link src 10.0.0.1
As you can see, there is single interface with single address, single device route automatically generated by kernel. Simple bird config:
# cat bird.conf # BEGIN bird config router id 10.0.0.1; protocol device { scan time 3; } protocol kernel krnl4 { ipv4 { table master4; import all; export all; }; learn; } protocol ospf ospf1 { ipv4 { table master4; import all; export all; }; area 0.0.0.0 { stub no; interface "eth0" { stub yes; }; }; } # END bird config
When I run bird with this configuration, it inserts another route:
# ip route 10.0.0.0/24 <http://10.0.0.0/24> dev eth0 proto kernel scope link src 10.0.0.1 10.0.0.0/24 <http://10.0.0.0/24> dev eth0 proto bird scope link metric 32
Is this expected/correct behaviour? Or should I somehow filter those device routes out? I want those device routes to be read by OSPF, of course, just not to output them back. What is the best way to get rid of them?
Another unrelated question: When I run bird, it logs this:
bird: KRT: Netlink strict checking failed, will scan all tables at once bird: Started
Should I do something about that failed strict check? Is it important or only some info message I shouldn't worry about?
Thank you
ico
On Mon, Feb 20, 2023, at 13:13, ico wrote:
Thanks for answer. I tried this filter but the source is RTS_OSPF, not RTS_DEVICE. Also the proto is "ospf1".
I use this: protocol kernel kernel4 { scan time 60; learn; ipv4 { import all; export where source ~ [RTS_OSPF, RTS_OSPF_EXT1, RTS_OSPF_EXT2]; }; }
On Mon, Feb 20, 2023 at 02:47:39PM +0100, ico wrote:
Hello all,
Here at $work we are using bird for OSPF at some 30 linux boxes. Works great. But there is a thing that confuses me: ... When I run bird with this configuration, it inserts another route:
# ip route 10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.1 10.0.0.0/24 dev eth0 proto bird scope link metric 32
Is this expected/correct behaviour? Or should I somehow filter those device routes out? I want those device routes to be read by OSPF, of course, just not to output them back. What is the best way to get rid of them?
Hello. It is expected behavior. OSPF protocol computes best routes for all networks in the OSPF domain, that includes routes to directly attached networks (which are usually the direct routes, although in principle OSPF could find indirect route with lower metric even for directly attached network). You can just ignore them.
Another unrelated question: When I run bird, it logs this:
bird: KRT: Netlink strict checking failed, will scan all tables at once bird: Started
Should I do something about that failed strict check? Is it important or only some info message I shouldn't worry about?
That is just old version of Linux kernel. It should work ok even with this warning. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@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."
Heh that's my current solution - I just ignore it :) (although it didn't seem the correct thing to do) Thanks for your answer. ico On 20. 2. 2023 16:40, Ondrej Zajicek wrote:
On Mon, Feb 20, 2023 at 02:47:39PM +0100, ico wrote:
Hello all,
Here at $work we are using bird for OSPF at some 30 linux boxes. Works great. But there is a thing that confuses me: ... When I run bird with this configuration, it inserts another route:
# ip route 10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.1 10.0.0.0/24 dev eth0 proto bird scope link metric 32
Is this expected/correct behaviour? Or should I somehow filter those device routes out? I want those device routes to be read by OSPF, of course, just not to output them back. What is the best way to get rid of them?
Hello.
It is expected behavior. OSPF protocol computes best routes for all networks in the OSPF domain, that includes routes to directly attached networks (which are usually the direct routes, although in principle OSPF could find indirect route with lower metric even for directly attached network). You can just ignore them.
Another unrelated question: When I run bird, it logs this:
bird: KRT: Netlink strict checking failed, will scan all tables at once bird: Started
Should I do something about that failed strict check? Is it important or only some info message I shouldn't worry about?
That is just old version of Linux kernel. It should work ok even with this warning.
participants (4)
-
ico -
Kevin P. Fleming -
Ondrej Zajicek -
Petr Boltík