null routing multiple communities

micah anderson micah at riseup.net
Thu Jun 4 00:11:40 CEST 2020


Hi,

I have some peers who want community string 666 set to null route, and
some who want :0, I'm trying to setup bird so when I null route a /32,
it gets properly null routed everywhere.

I'm stuck with the routes not actually exported to the peers, I'm not
sure why. Any suggestions would be very much appreciated!

define NULLROUTE = [ 198.51.100.1/32, 198.51.100.2/32 ];
define OURNETS = [ 198.252.153.0/24, 198.51.100.0/24 ];

protocol static static_bgp {
    import all;
    preference 10000;
    route 198.252.153.0/24 reject;
    route 198.51.100.0/24 blackhole;
}

protocol bgp special {
    import filter bgp_in;
    export filter bgp_special_bl;
    multihop 255;
    local as ASN;
    neighbor x.x.x.x as xxxxx;
    graceful restart;
    passive;
}

protocol bgp cogent_blackhole {
    description "Cogent blackhole server";
    local as ASN;
    neighbor 66.28.8.1 as 174;
    multihop 255;
    import filter bgp_in;
    export filter bgp_nullroute;
}

function our_network()
{
  return net ~ OURNETS;
}

function nullroute(prefix set nroute)
{
  if our_network() then {
    bgp_community = -empty-;
    bgp_community.add((ASN,666));
    return net ~ nroute;
  }
  else {
    reject;
  }
}

filter bgp_special_bl {
  nullroute(NULLROUTE);
  if (ASN,666) ~ bgp_community && net.len = 32 && our_network() then {
      bgp_community = -empty-;
      bgp_community.add((ASN,0));
      accept;
  }
  else {
    reject;
  }
}

filter bgp_nullroute {
  nullroute(NULLROUTE);
  if (ASN,666) ~ bgp_community && net.len = 32 && our_network() then {
      accept;
  }
  else {
    reject;
  }
}

all of these return empty:
birdc show route filter bgp_special_bl
birdc show route filter bgp_nullroute
birdc show route export bgp_special
birdc show route export cogent_blackhole

I'd love any suggestions of things to try, or if you have a better way
to do this, i'm all ears.

-- 
        micah


More information about the Bird-users mailing list