Unexpected behavior of static routes

Ondrej Zajicek santiago at crfreenet.org
Wed May 10 03:01:52 CEST 2017


On Tue, May 09, 2017 at 06:39:04PM +0200, Alexander Demenshin wrote:
> Hi,
> 
> I have something like this in my config (bird 1.6.3 @linux):
> 
> protocol static {
>   route 10.1.0.0/24 via "eth1";
>   route 10.2.0.0/24 via 10.1.0.1;
> }
> 
> Route to 10.1.0.0/24 is installed as expected, but, route to 10.2.0.0/24
> is not showing up anywhere, while it seems logical that once its covering
> network is routed it should be installed too.
> 
> Even if I add route to 10.1.0.0/24 manually (outside of bird) and it is
> visible to bird, 10.2/24 is still ignored, it is only installed if (and
> only if) I add an IP within 10.2.0.0/24 range to the interface.
> 
> Is it a bug or intentional behavior? Is there any way to workaround this?

Hi

It is expected behavior. It is not optimal, but it is how it works. Next
hops are validated against interface prefixes reported by OS, not against
device routes in routing table.

> Yes, I know that I can use recursive routes but this is not an option in
> my setup - the gateway has to be exact, routing through interface will
> not work.

I think that recursive routes should work. If you have a recursive route
that is resolved to a device route, then the original gateway is kept.


Another workaround is to add 10.1.0.0/24 as a regular address range to
the interface. If you do not want to assign a real address to the iface,
then you could use ptp address like:

ip addr add 192.168.1.1 peer 10.1.0.1 dev eth1;


It generates something like:

    inet 192.168.81.10/24 brd 192.168.81.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.81.10 peer 10.1.0.1/32 scope global eth0
       valid_lft forever preferred_lft forever


-- 
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."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20170510/7f3eeaae/attachment.asc>


More information about the Bird-users mailing list