Redistribute loopback in OSPF
Hello, I'm starting to use Bird, and I try to redistribute loopback in ospf. (So it seems easy...) rt01 : interface ens18 > 10.0.4.5/24 interface loopback > 10.99.99.1/32 (and 127.0.0.1/8) rt02 : interface ens18 > 10.0.4.6/24 interface loopback > 10.99.99.100/32 (and 127.0.0.1/8) Below the configuration of rt01 and rt02 : rt01 : filter loopbacks { if (net = 10.99.99.1/32 ) then accept; else reject; } protocol ospf { import all; export filter loopbacks; area 0 { interface "ens18" { cost 5; type broadcast; hello 5; retransmit 2; wait 10; dead 20; authentication cryptographic; password "toto"; }; }; } rt02 : filter loopbacks { if (net = 10.99.99.100/32 ) then accept; else reject; } protocol ospf { import all; export filter loopbacks; area 0 { interface "ens18" { cost 5; type broadcast; hello 5; retransmit 2; wait 10; dead 20; authentication cryptographic; password "toto"; }; }; } But it doesn't work. Each router don't receive the route 10.99.99.X bird> sh route 0.0.0.0/0 via 10.0.4.1 on ens18 [kernel1 22:01:40] * (10) 10.0.4.0/24 dev ens18 [direct1 22:01:40] * (240) dev ens18 [ospf1 22:01:48] I (150/5) [10.0.4.5] Could you help me please ? Regards, Quentin
Anno domini 2017 Quentin Ritoul scripsit: Hi,
I'm starting to use Bird, and I try to redistribute loopback in ospf. (So it seems easy...)
[...]
Below the configuration of rt01 and rt02 :
rt01 :
filter loopbacks { if (net = 10.99.99.1/32 ) then accept; else reject; }
protocol ospf { import all; export filter loopbacks;
area 0 { interface "ens18" { cost 5; type broadcast; hello 5; retransmit 2; wait 10; dead 20; authentication cryptographic; password "toto"; };
}; } [...]
You are missing the piece where bird learns about the prefix(es) on the "lo" interface. That would be a "protocol direct" for example. For IPv4 the simplest way is to add "lo" as a stub interface (== learn prefixes but don't actually speak the OSPF protocol) protocol ospf { import all export none; area 0 { ... interface "lo" { stub yes; }; }; } For IPv6 you need some hack, due to a limitation within bird (which I hope some of the authors will explain to me ;)): I use this the following way: protocol direct lo_v6 { interface "lo"; } protocol ospf { import all; export where protocol = "lo_v6"; area 0 { ... }; } Best Max -- "Wer nicht mehr liebt und nicht mehr irrt, der lasse sich begraben." -- Johann Wolfgang von Goethe
Hello, Maximilian is correct. The OSPF protocol is different from the others, in that it learns the interface addresses by itself, without need for the direct protocol. So you just place the "lo" interface as a stub interface, in the desired area. Regarding IPv6, there is a known issue, that affects IPv6 addresses in the loopback interface. But there is a simple workaround. The problem was reported here by a colleague of mine, Bernardo Figueiredo: http://bird.network.cz/pipermail/bird-users/2016-July/010520.html Ondrej Zajicek explains, in his reply: ( http://bird.network.cz/pipermail/bird-users/2016-July/010527.html )
This is a known problem, the simple workaround is either to add link-local address to the loopback (e.g. fe80::1/64), or use dummy interface instead of loopback.
So, the easiest solution is to simply add a link-local address to the "lo" interface. E.g. if you are in Debian, you would do something like this, in /etc/network/interfaces: auto lo iface lo inet loopback up /sbin/ip addr add 192.0.2.1/32 dev lo up /sbin/ip addr add 2001:db8::16:1/128 dev lo #XXX workaround so bird recognizes lo interface up /sbin/ip addr add fe80::1/128 dev lo scope link Then just add "lo" to the area as a stub interface, exactly like you would do in IPv4. Regards, Israel On 05/17/2017 09:52 PM, Maximilian Wilhelm wrote:
Anno domini 2017 Quentin Ritoul scripsit:
Hi,
I'm starting to use Bird, and I try to redistribute loopback in ospf. (So it seems easy...)
[...]
Below the configuration of rt01 and rt02 :
rt01 :
filter loopbacks { if (net = 10.99.99.1/32 ) then accept; else reject; }
protocol ospf { import all; export filter loopbacks;
area 0 { interface "ens18" { cost 5; type broadcast; hello 5; retransmit 2; wait 10; dead 20; authentication cryptographic; password "toto"; };
}; } [...]
You are missing the piece where bird learns about the prefix(es) on the "lo" interface. That would be a "protocol direct" for example.
For IPv4 the simplest way is to add "lo" as a stub interface (== learn prefixes but don't actually speak the OSPF protocol)
protocol ospf { import all export none;
area 0 { ...
interface "lo" { stub yes; }; }; }
For IPv6 you need some hack, due to a limitation within bird (which I hope some of the authors will explain to me ;)):
I use this the following way:
protocol direct lo_v6 { interface "lo"; }
protocol ospf { import all; export where protocol = "lo_v6";
area 0 { ... }; }
Best Max
participants (3)
-
Israel G. Lugo -
Maximilian Wilhelm -
Quentin Ritoul