How can I set krt_realm in the kernel protocol by gw (nexthop) value?

Eric Wheeler bird at lists.ewheeler.net
Fri Jul 30 05:59:28 CEST 2021


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