<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
On 13/05/2023 4:12 pm, Ross Tajvar wrote:<br>
<blockquote type="cite"
cite="mid:CA+FDdDQh-2fbDC_25E3BTJfXs96TaQCqZtLepms1mfBNK6GMqw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">
<div>What are you using the prefix set for in the first place?<br>
</div>
</div>
</blockquote>
In this particular case it is used to filter inbound and restrict
outbound advertisements with upstream BGP routers to ensure that
site doesn't receive its own routes back, but also protect the rest
of the network from accidentally advertising the wrong routes (like
default route).<br>
<br>
In some situations the routes may be directly connected (and so fed
into the route tables by direct protocol entries), others via
downstream hosts like I mentioned and that point we need to add the
routes one-by-one into the tables.<br>
<br>
<blockquote type="cite"
cite="mid:CA+FDdDQh-2fbDC_25E3BTJfXs96TaQCqZtLepms1mfBNK6GMqw@mail.gmail.com">
<div dir="auto">
<div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, May 11, 2023, 2:34
AM William <<a href="mailto:bird@is.unlawful.id.au"
moz-do-not-send="true" class="moz-txt-link-freetext">bird@is.unlawful.id.au</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">On
10/05/2023 19:46, Maria Matejka via Bird-users wrote:<br>
> Hello!<br>
<br>
Thanks for replying.<br>
<br>
> On 5/10/23 11:13, William wrote:<br>
>> Hi All,<br>
>> I've been digging around trying to find a nice
way of doing it but <br>
>> can't seem to find a valid answer.<br>
>> <br>
>> Is there a way to use a prefix set to create
static routes?<br>
> <br>
> No, this is not possible and implementing this would
be surprisingly<br>
> difficult as the prefix sets are implemented as a
compressed trie<br>
> optimized for fast lookup and not enumeration.<br>
> <br>
> Also imagine this:<br>
> <br>
> define my_route_set = [ 2001:db8/32+ ]; # note the
plus sign<br>
> protocol static { ipv6; route my_route_set via
2001:db8::dead:beef; }<br>
> <br>
> This short code would generate approx. 7.9e28 routes.<br>
<br>
Yeah, that could hurt.<br>
<br>
> <br>
> If you could elaborate more precisely what you are
trying to achieve<br>
> as a whole result, we may try to help you find how to
do it in the way<br>
> BIRD is designed.<br>
<br>
We have a number of remote sites where there are
non-dynamically routed <br>
downstream subnets that we need to add as static routes
(anything from 1 <br>
to 20+ per site) but also advertise upstream back into the
WAN.<br>
<br>
Instead of specifying each prefix as an individual static
route I was <br>
hoping to be able to use the existing prefix set to act as
a list of <br>
routes to add. If there was a way to iterate over the set
in a loop <br>
fashion then that would suffice. In our instance there
aren't modifiers <br>
on the masks (no -'s, +'s or {minlen, maxlen}) hence the
idea of being <br>
able to use the set as "just a list" - this could be a
condition of <br>
using it for that function.<br>
<br>
For example (twist on my original):<br>
<br>
define my_route_set = [ <a href="http://10.1.2.3/24"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">10.1.2.3/24</a>, <a
href="http://172.20.4.2/24" rel="noreferrer noreferrer"
target="_blank" moz-do-not-send="true">172.20.4.2/24</a>,
<a href="http://10.200.0.0/23" rel="noreferrer noreferrer"
target="_blank" moz-do-not-send="true">10.200.0.0/23</a>
];<br>
<br>
protocol static route_set {<br>
ipv4 {<br>
table Some_Routes;<br>
}<br>
for ThisRoute in my_route_set {<br>
route ThisRoute via 192.168.55.2; # downstream
static gateway<br>
}<br>
route <a href="http://5.6.7.8/32" rel="noreferrer
noreferrer" target="_blank" moz-do-not-send="true">5.6.7.8/32</a>
via 192.168.55.1;<br>
}<br>
<br>
Resulting in:<br>
bird> sh route table Some_Routes<br>
Table Some_Routes:<br>
<a href="http://10.1.2.3/24" rel="noreferrer noreferrer"
target="_blank" moz-do-not-send="true">10.1.2.3/24</a>
unicast [route_set 2023-05-10] * (200)<br>
via 192.168.55.2 on ens256<br>
<a href="http://10.20.4.2/24" rel="noreferrer noreferrer"
target="_blank" moz-do-not-send="true">10.20.4.2/24</a>
unicast [route_set 2023-05-10] * (200)<br>
via 192.168.55.2 on ens256<br>
<a href="http://10.200.0.0/23" rel="noreferrer noreferrer"
target="_blank" moz-do-not-send="true">10.200.0.0/23</a>
unicast [route_set 2023-05-10] * (200)<br>
via 192.168.55.2 on ens256<br>
<a href="http://5.6.7.8/32" rel="noreferrer noreferrer"
target="_blank" moz-do-not-send="true">5.6.7.8/32</a>
unicast [route_set 2023-05-10] * (200)<br>
via 192.168.55.1 on ens256<br>
<a href="http://192.168.55.0/24" rel="noreferrer
noreferrer" target="_blank" moz-do-not-send="true">192.168.55.0/24</a>
unicast [Local_Ints 2023-05-10] * (240)<br>
dev ens256<br>
bird><br>
<br>
Hope that explains better what I'm hoping to achieve. I
couldn't see a <br>
way of doing it with if..then..else or case statements.
The only other <br>
option would be to have a script scrape the set out of the
config and <br>
prepare an include file *shudder*.<br>
<br>
Regards,<br>
William<br>
</blockquote>
</div>
</div>
</div>
</blockquote>
</body>
</html>