bird 2.0: show only IPv4 or IPv6 routes from birdc
We've been using bird 1.6.8 to advertise nullzero routes from a FreeBSD box to our routers for awhile. (We use quagga to the same for IPv4.) We're in the process of upgrading to 2.0.7 and will use bird for IPv4 and IPv6. I'm so far unable to come up with good ways of dumping only IPv4 or IPv4 routes. I can't even find concrete examples of what's possible. A filter example I found is: https://bird.network.cz/?get_doc&v=20&f=bird-5.html#ss5.3 show route filter { if 127.0.0.5 ~ net then accept; } So I for IPv6 I tried: show route filter { if net.len = 128 then accept; } which works but it logs error messages: Filter (unnamed) did not return accept nor reject. Make up your mind This works without errors: show route filter { if net.len = 128 then accept; reject; } As does: show route where net.len = 128 Both seem like hacks to me and do not allow unambiguous printing of IPv4 routes: show route where net.len = 32 In my case I know I won't have any IPv6 routes that are 32 bits but there must be a better way. I also found: show route table master4 show route table master6 I'd rather not depend on the names of default routing tables. I suppose I could explicitly import the kernel routes into v4 and v6 tables but routing works without this extra complexity. One experiment I tried was: show route filter { print "net.type is ", net.type; } which logs 1 or 2 for IPv4 or IPv6: bird: net.type is (enum 36)1 bird: net.type is (enum 36)2 but the obvious commands do not print any routes: show route where net.type = 1 show route where net.type = 2 And anyway I couldn't find any keywords for ipv4 and ipv6. What's the magic I'm missing? How can I dump only IPv4 or dump only IPv6 routes? Craig
On Mon, Apr 06, 2020 at 01:39:45PM -0700, Craig Leres wrote:
I also found:
show route table master4 show route table master6
I'd rather not depend on the names of default routing tables. I suppose I could explicitly import the kernel routes into v4 and v6 tables but routing works without this extra complexity.
Hi I think this is the best way. IPv4 and IPv6 routes are in separate tables, so just specify that table. You can use filter expression for route type, but this is more efficient, as it will only process routes from given table, while filter expression would process routes from both tables and then eliminate ones that have different net.type
One experiment I tried was:
show route filter { print "net.type is ", net.type; }
which logs 1 or 2 for IPv4 or IPv6:
bird: net.type is (enum 36)1 bird: net.type is (enum 36)2
This is just missing code for proper printing of enums, it should show NET_IP4, NET_IP6.
but the obvious commands do not print any routes:
show route where net.type = 1 show route where net.type = 2
Try: show route where net.type = NET_IP4 show route where net.type = NET_IP6 See https://bird.network.cz/?get_doc&v=20&f=bird-5.html#type-prefix -- 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 (2)
-
Craig Leres -
Ondrej Zajicek