The bogon filter is a separate policy with no final action, placed before the per-peer policy in the import chain:
PE3, PE4, PE5:
set policy-options policy-statement BOGONS term V4 from route-filter 10.0.0.0/8 orlonger
set policy-options policy-statement BOGONS term V4 from route-filter 172.16.0.0/12 orlonger
set policy-options policy-statement BOGONS term V4 from route-filter 192.168.0.0/16 orlonger
set policy-options policy-statement BOGONS term V4 from route-filter 0.0.0.0/8 orlonger
set policy-options policy-statement BOGONS term V4 from route-filter 127.0.0.0/8 orlonger
set policy-options policy-statement BOGONS term V4 from route-filter 100.64.0.0/10 orlonger
set policy-options policy-statement BOGONS term V4 from route-filter 169.254.0.0/16 orlonger
set policy-options policy-statement BOGONS term V4 from route-filter 224.0.0.0/3 orlonger
set policy-options policy-statement BOGONS term V4 from route-filter 203.0.113.0/24 orlonger
set policy-options policy-statement BOGONS term V4 from route-filter 0.0.0.0/0 prefix-length-range /25-/32
set policy-options policy-statement BOGONS term V4 then reject
set policy-options policy-statement BOGONS term V6 from route-filter 2001:db8:3000::/48 orlonger
set policy-options policy-statement BOGONS term V6 from route-filter fc00::/7 orlonger
set policy-options policy-statement BOGONS term V6 from route-filter fe80::/10 orlonger
set policy-options policy-statement BOGONS term V6 from route-filter ff00::/8 orlonger
set policy-options policy-statement BOGONS term V6 from route-filter ::/0 prefix-length-range /49-/128
set policy-options policy-statement BOGONS term V6 then reject
set policy-options community C-ISPX members 65030:100
set policy-options community C-ISPY members 65030:200
set policy-options community C-PEERZ members 65030:300
224.0.0.0/3 orlonger covers both multicast 224.0.0.0/4 and the reserved 240.0.0.0/4. IPv4 route filters do not match IPv6 routes and vice versa, so one policy works for both families.
Import and export policies:
PE3:
set policy-options policy-statement ISP-X-IN term ALL then community add C-ISPX
set policy-options policy-statement ISP-X-IN term ALL then local-preference 120
set policy-options policy-statement ISP-X-IN term ALL then accept
set protocols bgp group ISP-X import [ BOGONS ISP-X-IN ]
set protocols bgp group ISP-X export TO-ISP-X
PE4:
set policy-options policy-statement ISP-Y-IN term ALL then community add C-ISPY
set policy-options policy-statement ISP-Y-IN term ALL then local-preference 100
set policy-options policy-statement ISP-Y-IN term ALL then accept
set protocols bgp group ISP-Y import [ BOGONS ISP-Y-IN ]
set protocols bgp group ISP-Y export TO-ISP-Y
PE5:
set policy-options policy-statement PEER-Z-IN term ALL then community add C-PEERZ
set policy-options policy-statement PEER-Z-IN term ALL then local-preference 200
set policy-options policy-statement PEER-Z-IN term ALL then accept
set protocols bgp group PEER-Z import [ BOGONS PEER-Z-IN ]
set protocols bgp group PEER-Z export TO-PEER-Z
The IPv4 aggregate on PE3, PE4 and PE5 has 203.0.113.1/32 and 203.0.113.2/32 on lo0 of PE1 and PE2 as contributing routes. These addresses live in level 1 and are leaked to level 2 by Junos as internal routes, so PE3, PE4 and PE5 see them through IS-IS. If both disappear, the aggregate is withdrawn automatically.
PE3, PE4, PE5:
set routing-options aggregate route 203.0.113.0/24
PE1:
set interfaces lo0 unit 0 family inet address 203.0.113.1/32
set interfaces lo0 unit 0 family inet6 address 2001:db8:3000::11/128
set routing-options rib inet6.0 aggregate route 2001:db8:3000::/48
PE2:
set interfaces lo0 unit 0 family inet address 203.0.113.2/32
External export policy for PE3 (PE4 and PE5 have additional parts in t14):
PE3:
set policy-options policy-statement TO-ISP-X term OWN4 from protocol aggregate
set policy-options policy-statement TO-ISP-X term OWN4 from route-filter 203.0.113.0/24 exact
set policy-options policy-statement TO-ISP-X term OWN4 then accept
set policy-options policy-statement TO-ISP-X term OWN6 from protocol bgp
set policy-options policy-statement TO-ISP-X term OWN6 from route-filter 2001:db8:3000::/48 exact
set policy-options policy-statement TO-ISP-X term OWN6 then accept
set policy-options policy-statement TO-ISP-X term REST then reject
The REST then reject term is what prevents transit: no route learned from an ISP or peer is sent to another ISP or peer. On PE1, the iBGP export policy that puts the /48 into 6PE is in t16.
Verification:
show route advertising-protocol bgp 198.51.100.2
show route advertising-protocol bgp 2001:db8:ff00:1::2
show route receive-protocol bgp 198.51.100.2 hidden
show route community 65030:300 terse
show route 203.0.113.0/24 extensive | match "Contributing|State"
Each ISP receives exactly two prefixes. From PE1, show route 0/0 exact or any prefix received from all three sources selects the PEER-Z path (LP 200).