Redistribute loopback in OSPF

Israel G. Lugo israel.lugo at lugosys.com
Thu May 18 02:50:43 CEST 2017


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



More information about the Bird-users mailing list