Date created: Friday, January 15, 2016 1:38:12 PM. Last modified: Friday, January 12, 2024 5:59:06 PM

RTBH IPv6

RFC6666 allocates 0100::/64 for use as a range of IPv6 discard prefixes. Only a single /128 needs to be allocated even though the below example uses the entire /64. A /128 is preferred as this allows other IPs in the range to be allocated for other filtering purposes. The RFC6666 range is unique for this purpose. The IPv4 range below is from RFC5737 which is not ideal as this range is for documentation purposes, not for live operational use. Equally RFC1918 space is meant for private use and may genuinely be seen inside a routing table so using RFC1918 and/or RFC5737 space maybe misleading.

set routing-options static route 192.0.2.1/32 discard
set routing-options static route 192.0.2.1/32 no-readvertise
set routing-options rib inet6.0 static route 0100::/64 discard
set routing-options rib inet6.0 static route 0100::/64 no-readvertise

set community RTBH-IPv4 members target:123456:6664
set community RTBH-IPv6 members target:123456:6666

set policy-options policy-statement PS-RTBH-IPv4-Export term RTBH-injection from protocol static
set policy-options policy-statement PS-RTBH-IPv4-Export term RTBH-injection from tag 6664
set policy-options policy-statement PS-RTBH-IPv4-Export term RTBH-injection from route-filter 0.0.0.0/0 prefix-length-range /32-/32
set policy-options policy-statement PS-RTBH-IPv4-Export term RTBH-injection then community add RTBH-IPv4
set policy-options policy-statement PS-RTBH-IPv4-Export term RTBH-injection then community add no-export
set policy-options policy-statement PS-RTBH-IPv4-Export term RTBH-injection then next-hop 192.0.2.1
set policy-options policy-statement PS-RTBH-IPv4-Export term RTBH-injection then accept

set policy-options policy-statement PS-RTBH-IPv6-Export term RTBH-injection from protocol static
set policy-options policy-statement PS-RTBH-IPv6-Export term RTBH-injection from tag 6666
set policy-options policy-statement PS-RTBH-IPv6-Export term RTBH-injection from route-filter ::/0 prefix-length-range /128-/128
set policy-options policy-statement PS-RTBH-IPv6-Export term RTBH-injection then community add RTBH-IPv6
set policy-options policy-statement PS-RTBH-IPv6-Export term RTBH-injection then community add no-export
set policy-options policy-statement PS-RTBH-IPv6-Export term RTBH-injection then next-hop 100::
set policy-options policy-statement PS-RTBH-IPv6-Export term RTBH-injection then accept