Converting a route between tables via pipe proto?
Hi, I'm trying to see if bird can accomplish the following and so far I can't seem to find a way to do it. Quick summary: I want to be able to modify a route (the actual IP/mask) between 2 interfaces. Setup is as follows: table A: routes learned as normal table B: I want to advertise a specific route into table B if there is another specific route learned on table A. Note that the route in table B is different than A but I want to link/convert them somehow. Why would I want to do this? This Linux setup is performing NETMAP to convert IPs when forwarded between 2 interfaces. I know the exact prefixes so I can enter them in the config but I want to dynamically advertise those into B but only if they are reachable via A. My first attempt was to use a proto pipe between the two tables and simply change the net variable: protocol pipe a_b_pipe { table b; peer table a; import filter { # a -> b if net ~ A.B.C.D/E then { net = F.G.H.I/J; accept; }; reject; }; export none; # b -> a } but that doesn't work: bird: /etc/bird/bird.conf:24:56 This static attribute is read-only. My second attempt was to setup filters/functions on the protos in table A to set some variable if the specific route is seen, then reference that variable via a static proto route in table B. This seems to be a no go as there are global constants (define xxx;) but attributes are local and function variables are also local scope. My third thinking was to somehow use bfd to cross the bridge as it were.. setup a static route with the bfd option in table B and have it communicate with a bfd in table A, but there doesn't seem to be any way to start/stop bfd on the table B side based on learning a specific route in table B. Other suggestions appreciated, or is this just not possible?
Hello! This is currently not possible. There are some thoughts how to make it possible, yet never finished and implemented. Maria On January 22, 2021 9:26:59 PM GMT+01:00, David Johnson <dave@oort.io> wrote:
Hi,
I'm trying to see if bird can accomplish the following and so far I can't seem to find a way to do it.
Quick summary: I want to be able to modify a route (the actual IP/mask) between 2 interfaces.
Setup is as follows:
table A: routes learned as normal
table B: I want to advertise a specific route into table B if there is another specific route learned on table A. Note that the route in table B is different than A but I want to link/convert them somehow.
Why would I want to do this? This Linux setup is performing NETMAP to convert IPs when forwarded between 2 interfaces. I know the exact prefixes so I can enter them in the config but I want to dynamically advertise those into B but only if they are reachable via A.
My first attempt was to use a proto pipe between the two tables and simply change the net variable:
protocol pipe a_b_pipe { table b; peer table a; import filter { # a -> b if net ~ A.B.C.D/E then { net = F.G.H.I/J; accept; }; reject; }; export none; # b -> a }
but that doesn't work: bird: /etc/bird/bird.conf:24:56 This static attribute is read-only.
My second attempt was to setup filters/functions on the protos in table A to set some variable if the specific route is seen, then reference that variable via a static proto route in table B. This seems to be a no go as there are global constants (define xxx;) but attributes are local and function variables are also local scope.
My third thinking was to somehow use bfd to cross the bridge as it were.. setup a static route with the bfd option in table B and have it communicate with a bfd in table A, but there doesn't seem to be any way to start/stop bfd on the table B side based on learning a specific route in table B.
Other suggestions appreciated, or is this just not possible?
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
On Fri, Jan 22, 2021 at 03:26:59PM -0500, David Johnson wrote:
Hi,
I'm trying to see if bird can accomplish the following and so far I can't seem to find a way to do it.
Quick summary: I want to be able to modify a route (the actual IP/mask) between 2 interfaces.
Setup is as follows:
table A: routes learned as normal
table B: I want to advertise a specific route into table B if there is another specific route learned on table A. Note that the route in table B is different than A but I want to link/convert them somehow.
Why would I want to do this? This Linux setup is performing NETMAP to convert IPs when forwarded between 2 interfaces. I know the exact prefixes so I can enter them in the config but I want to dynamically advertise those into B but only if they are reachable via A.
My first attempt was to use a proto pipe between the two tables and simply change the net variable:
protocol pipe a_b_pipe { table b; peer table a; import filter { # a -> b if net ~ A.B.C.D/E then { net = F.G.H.I/J; accept; }; reject; }; export none; # b -> a }
but that doesn't work: bird: /etc/bird/bird.conf:24:56 This static attribute is read-only.
My second attempt was to setup filters/functions on the protos in table A to set some variable if the specific route is seen, then reference that variable via a static proto route in table B. This seems to be a no go as there are global constants (define xxx;) but attributes are local and function variables are also local scope.
Other suggestions appreciated, or is this just not possible?
Hi It is not possible to do this directly, but there is one ugly trick how to do that: You can use pipe to import route A.B.C.D/E from table a to auxiliary table c. Then have static route F.G.H.I/J with recursive nexthop from A.B.C.D/E put to auxiliary table c. If route A.B.C.D/E is exported to table c, then route F.G.H.I/J would inherit its nexthop, otherwise it would be unreachable. Last, you can have pipe from table c to table b that accepts only network F.G.H.I/J and only when it is reachable (dest = RTD_UNICAST). And you should also reset its gateway (using 'gw = gw;' filter command), so it is no longer recursive when propagated to table b. -- 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)
-
David Johnson -
Maria Matějka -
Ondrej Zajicek