bird bgp export to certain ASN instead of all

Steve SY Fan sfan at chtsc.net
Wed Mar 16 06:35:07 CET 2016


Dear All

I am a newbie of bird user. I am running bird version 1.4.5 on my centos 
box.

Now We are struggling with the BGP export filter, as the purpose we are 
willing to import certain ASN's prefixes in to our table ( e.g google 
asn 15169 ), and also only export our prefix to certain ASN. in this 
case, some prefixes will be always routed through one up link. We are 
done with the import filter to select the incoming routes, but we are 
failed with export filter, seems nothing happen on the export filter.

This is my configuration.

log stderr all;
log "/var/log/bird.log" all;

router id 172.16.120.41;

table bird_k150;
table bird_k151

protocol kernel kernel150{
         persist;
         scan time 20;
         export all;
         table bird_k150;
         kernel table 150;
}

protocol kernel kernel151{
         persist;
         scan time 20;
         export all;
         table bird_k151;
         kernel table 151;
}

protocol kernel {
         persist;
         scan time 20;
         export all;
}

protocol device {
         scan time 10;
}

protocol static static_bgp_null{
         table bird_k151;
         route a.b.c.0/24 blackhole;
}

protocol pipe pipe_n_he{
         peer table bird_k151;
         export filter {if source=RTS_OSPF_EXT2 && net=65.19.175.17/32 
|| net=61.14.134.86/32 then accept; reject;};
         import none;


protocol ospf hyospf{
         rfc1583compat yes;
         export none;
         area 0.0.0.0 {
                 interface "eth*" {
                 };
         };
}


protocol bgp bgp_he_net{
         description "he.net uplink";
         local 10.96.254.34 as 133194;
         neighbor 65.19.175.17 as 6939;
         multihop 4;
         import all;
         table bird_k151;
         next hop self;
         export filter {
                 if net~103.254.196.0/24 then {
                         bgp_path.prepend(133194);
                          bgp_path.prepend(133194);
                         accept;
                 }
                 reject;
         };
}

protocol bgp bgp_telstra{
         description "telstra uplink";
         local 202.147.20.169 as 133194;
         neighbor 61.14.134.86 as 10026;
         multihop 3;
         import filter {
                 if bgp_path.last ~ [ 15169, 8075, 8001 ] then {
                         bgp_local_pref=180;
                         accept;
                         }
                 reject;
         };
         table bird_k151;
         next hop self;
         export filter {
                 if ( source = RTS_STATIC && net ~ 103.254.196.0/24 ) then {
                         if ! ( bgp_path ~ [ 15169, 8075, 8001, 4739 ] ) 
then {
                                 bgp_path.prepend(133194);
                                  bgp_path.prepend(133194);
                                   bgp_path.prepend(133194);
                                    bgp_path.prepend(133194);
                         }
                         accept;
                 }
                 reject;
         };
}


Seems it put 4 times prepend after all that ignoring the if statement, 
May I know if we can use bgp_path selection in export filter.

Thanks !


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20160316/1f75bab0/attachment.html>


More information about the Bird-users mailing list