Unexpected behavior of static routes
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? 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. The aim is to maintain a list of routes which will be activated if: - device is up - gateway becomes available through any other active route (like in my example) Thank you! -- With best regards, Alexander.
Alexander, You have a physical interface (e.g. eth0) with an address assigned to the 10.1.0.1/24 on the system? You shouldn’t need an address in the 10.2.0.0/24 subnet assigned to an interface. Cheers Mike -- Michael McConnell WINK Streaming; email: michael@winkstreaming.com <mailto:michael@winkstreaming.com> phone: +1 312 281-5433 x 7400 cell: +506 8706-2389 skype: wink-michael web: http://winkstreaming.com <http://winkstreaming.com/>
On May 9, 2017, at 10:39 AM, Alexander Demenshin <aldem-bird.201704@nk7.net> 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?
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.
The aim is to maintain a list of routes which will be activated if:
- device is up - gateway becomes available through any other active route (like in my example)
Thank you!
-- With best regards, Alexander.
On 2017-05-09 20:18, Michael McConnell wrote:
You have a physical interface (e.g. eth0) with an address assigned to the 10.1.0.1/24 on the system?
No, I don't - this is exactly the problem. It has a completely different address in different network, and I do not want a router to have an address in 10.1.0.0/24 network (it only sends packets and is not used as a default gateway). Just for example: eth0 has address 192.168.1.1/24 (one and only) When it is active (up), I want to route network 10.1.0.0/24 via this interface, and network 10.2.0.0/24 via gateway 10.1.0.1 (which is a separate host). Manual setup is easy: ip route add 10.1.0.0/24 dev eth0 ip route add 10.2.0.0/24 via 10.1.0.1 or even (if I don't want to route 10.1/24) just as ip route add 10.2.0.0/24 via 10.1.0.1 dev eth0 onlink though the latter is not possible to define in bird. The problem is that adding route in linux works but only as long as interface is up, it will be removed automatically otherwise, that's why I need bird, to keep those extra routes alive automatically, and no, ospf nor any other kind of dynamic protocol is not an option. Currently bird only keeps active either interface routes or routes via gateways which are directly connected, i.e. only when interface itself has assigned address from those networks (though any network routed via interface is kind of directly connected too, just without a local address). -- With best regards, Alexander.
Right, what you are doing is something I do all day long. I’ve looked over my configs and the only thing I can see that might be missing related to kernel. protocol kernel { export all; Sorry I’m not more help, but I can tell you that is definitely not the expected behaviour. Mike -- Michael McConnell WINK Streaming; email: michael@winkstreaming.com <mailto:michael@winkstreaming.com> phone: +1 312 281-5433 x 7400 cell: +506 8706-2389 skype: wink-michael web: http://winkstreaming.com <http://winkstreaming.com/>
On May 9, 2017, at 1:11 PM, Alexander Demenshin <aldem-bird.201704@nk7.net> wrote:
On 2017-05-09 20:18, Michael McConnell wrote:
You have a physical interface (e.g. eth0) with an address assigned to the 10.1.0.1/24 on the system?
No, I don't - this is exactly the problem. It has a completely different address in different network, and I do not want a router to have an address in 10.1.0.0/24 network (it only sends packets and is not used as a default gateway).
Just for example:
eth0 has address 192.168.1.1/24 (one and only)
When it is active (up), I want to route network 10.1.0.0/24 via this interface, and network 10.2.0.0/24 via gateway 10.1.0.1 (which is a separate host).
Manual setup is easy:
ip route add 10.1.0.0/24 dev eth0 ip route add 10.2.0.0/24 via 10.1.0.1
or even (if I don't want to route 10.1/24) just as
ip route add 10.2.0.0/24 via 10.1.0.1 dev eth0 onlink
though the latter is not possible to define in bird.
The problem is that adding route in linux works but only as long as interface is up, it will be removed automatically otherwise, that's why I need bird, to keep those extra routes alive automatically, and no, ospf nor any other kind of dynamic protocol is not an option.
Currently bird only keeps active either interface routes or routes via gateways which are directly connected, i.e. only when interface itself has assigned address from those networks (though any network routed via interface is kind of directly connected too, just without a local address).
-- With best regards, Alexander.
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@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."
participants (3)
-
Alexander Demenshin -
Michael McConnell -
Ondrej Zajicek