You can set route attributes when defining static routes.

E.g. we stamp route preference onto sets of static routes (faked out example):

protocol static MY_STATIC_PROTO {
    route 192.0.2.0/24 via 10.0.0.1 {
        bgp_med = 90;
        preference = 101;
    };
}

I haven't tried setting BGP communities directly on static routes there, but give it a shot? Alternatively, if you want to set an alternate arbitrary tag, maybe you want to create a custom attribute (https://bird.network.cz/?get_doc&v=20&f=bird-5.html#ss5.5) that you mark on your static routes, that can be read on BGP export to decide which communities to apply?

On Wed, Apr 12, 2023 at 4:51 PM Alexander Zubkov via Bird-users <bird-users@network.cz> wrote:
Hi,

Just look at the docs:
https://bird.network.cz/?get_doc&v=20&f=bird-6.html#ss6.14


On Wed, Apr 12, 2023, 23:57 Valery Lutoshkin <vpluto@gmail.com> wrote:
Hi,

I use Bird 2.0.9 to spread a special list of prefixes (about 100k) via BGP to an unknown list of users (around 1k).

The prefixes are supposed to be marked by different communities (6 right now) and receivers should be able to filter them by those communities to use only prefixes they want.


While only one community should be attached to the prefix, I use just 6 different files with prefixes and attach the proper community in the import processes like this: 

protocol static importbgp_1 {

        ipv4 { import filter {bgp_community.add((65000,1)); accept;}; };

        include "/tmp/prefixes_1.txt";

}

Lines in the prefixes_1 file look like this:

route 1.3.7.7/32 unreachable; 


But when I need to attach several communities to the prefixes, I have to create 2^6=64 different static protocols and generate 64 different files.

And for 8 communities I will have to create 256 protocols and files.


If I could add some marks to routes in the imported file, I would use those marks in the import filter to attach communities to the prefix. 


But if I’m not mistaken, there is no way of doing that.


If there is a different solution to this issue that I’m unaware of, would you please let me know.


Best regards,

Valery