How can I set krt_realm in the kernel protocol by gw (nexthop) value?
Alexander Zubkov
green at qrator.net
Fri Jul 30 12:30:45 CEST 2021
You have to update krt_realm attribute in your filter, like that:
function gw_realms() {
if gw = 1.1.1.1 then return 1;
if gw = 2.2.2.2 then return 2;
if gw = 3.3.3.3 then return 3;
return 0;
}
filter peer_realms {
krt_realm = gw_realms();
accept;
}
protocol kernel kernel_ipv4 {
ipv4 {
export filter peer_realms;
};
}
On Fri, Jul 30, 2021 at 6:05 AM Eric Wheeler <bird at lists.ewheeler.net> wrote:
>
> Hello all,
>
> I would like to put routes in realms for traffic accounting based on the
> peer IP provided by a BGP route server on an exchange. I was thinking I
> could do something like this, but bird gives errors like "syntax error,
> unexpected KRT_REALM":
>
> filter gw_realms {
> if gw = 1.1.1.1 then return 1;
> if gw = 2.2.2.2 then return 2;
> if gw = 3.3.3.3 then return 3;
> return 0;
> }
>
> protocol kernel kernel_ipv4 {
> ipv4 {
> krt_realm filter peer_realms;
> };
> }
>
>
> What is a proper way to dynamically set the krt_realm attribute per gw?
>
> Thank you for your help!
>
> --
> Eric Wheeler
More information about the Bird-users
mailing list