selctive route download
Tim Weippert
weiti at weiti.org
Sun Jun 26 11:50:29 CEST 2016
Hi,
On Fri, Jun 24, 2016 at 05:42:28PM +0000, Harish Venkatraman wrote:
> Hi,
>
>
> Can someone help me in selective route download using bird?. I did not see any specific configs.
Note really sure if i understand it correctly, you want to be selective what routes get installed from an protocol like bgp into the kernel/master table?
> Secondly I don't want the routes learnt by bgp peers to be installed in the kernel but only routes that are stored in a file through some application to be downloaded to the kernel how do i do it?. The file can have both prefixes and next-hops or just prefixes?
>
> Any help is much appreciated.
I would start with an BGP Peering writing to an own Routing Table and then use Pipes with filters to only install wanted routes. The Second part with an
File can be with an include and specific formatting of that file to be an function.
Just an example:
# Import/Export all to kernel from master table
protocol kernel {
scan time 20;
import all;
export all;
}
table PEER_TABLE; # Define BGP Peer Table
protocol bgp PEER {
table PEER_TABLE; # All learned Routes from this protocol will be in this table, not the master/kernel
igp table master; # Use master for IGP Routes to find peers
[ .. bgp options .. ];
}
include "/etc/bird/selective_routes";
protocol pipe PEER_KERNEL {
table PEER_TABLE;
peer table master;
import none; # No routes from kernel/master in BGP Table
export filter {
if ( selected_net() ) then {
accept;
} else {
reject;
}
};
}
In the include File, define an function which will return true/false for the configured prefixes:
function selected_net() {
return net ~ [
1.1.1.0/24, # Prefix to be exported to kernel
10.0.0.0/8{21,28}, # Prefix to be exported to kernel (only /21-28 from 10.0.0.0/8 range)
192.168.0.0/23+ # All Prefixes within 192.168.0.0/23 and smaller masks
];
}
if you change the include file, just reconfigure bird throught birdc or similar (birdc 'configure').
#> birdc 'configure'
BIRD 1.6.0 ready.
Reading configuration from /etc/bird/bird.conf
Reconfigured
HTH,
tim
--
Tim Weippert
http://weiti.org - weiti at weiti.org
GPG Fingerprint - E704 7303 6FF0 8393 ADB1 398E 67F2 94AE 5995 7DD8
More information about the Bird-users
mailing list