bird+juniper BGP RTBH
bird实例
log syslog all; debug protocols off; debug commands 0; router id 1.1.1.1; protocol static rtbh { route 99.99.99.99/32 blackhole; route 88.88.88.88/32 blackhole; } filter export_rtbh_out { # Limit to static routes if (proto = "rtbh") then { # Limit to /32 host routes (for now) if net.len = 32 then { bgp_community.add((65001,9999)); bgp_next_hop = 192.0.2.1; accept; } } reject; } protocol bgp ER3 { description "iBGP to Edge Router 3 for RTBH"; debug { states, events }; local 1.1.1.1 as 65001; neighbor 3.3.3.3 as 65001; import none; export filter export_rtbh_out; } protocol bgp ER4 { description "iBGP to Edge Router 4 for RTBH"; debug { states, events }; local 1.1.1.1 as 65001; neighbor 4.4.4.4 as 65001; import none; export filter export_rtbh_out; }
JUNOS 配置实例
routing-options { static { route 192.0.2.1/32 discard; } } protocols { bgp { group RTBH { type internal; import import-from-rs; expor deny-all; neighbor 1.1.1.1; } } } policy-options { policy-statement deny-all { term 1 { then reject; } } policy-statement import-from-rs { term 1 { from { community RTBH; route-filter 0.0.0.0/0 prefix-length-range /32-/32; } then accept; } term reject { then reject; } } community RTBH members 65001:9999; }
抄录自https://gist.github.com/floatingstatic/854aa504a92ab8bc3e044e434ec378c4