BGP Communities

I am trying to figure out a simple way to send a community string to my upstream provider. they say they need xxx:999 in order to handle anything less than a /24

I dont really understand this but anyway i need to send xxx:999

Set the BGP peer to use an outbound filter and manipulate the prefixes there:

add action=passthrough append-bgp-communities=65535:999 chain=ISP-out comment="append bgp-community=64512:999 where /32:" prefix-length=32

This is typically used to blackhole IPs within your announced prefixes and is generally pushed out to your ISP’s various entry points.


Herewith an assumption as to how your ISP is configured:
ISP’s ASN: 64512
Customer A’s ASN: 65535
Customer A prefix: 10.0.0.0/22
ISP’s blackhole community: 64512:500
Customer blackhole community: 64512:999

Overview:

  • Clean community values the ISP uses (would be nice if Router OS could filter on regex and selectively delete communities)
  • Accept customer prefixes, filtering on network, as path and prefix length (would be nice if RouterOS would support prefix-length=22-24,32)
  • Blackhole host routes (/32) that contain BGP community 64512:999 and append ISP’s internal blackholing community (64512:500)
  • Clear communities if prefix contains BGP community 64512:999 and wasn’t matched by previous /32 prefix length filter
  • Accept customer prefixes and append entry point reference community (64512:3000) and upstream announcement reference community (64512:4000). Additionally raise local preference.
  add action=jump chain=CustomerA-in comment="Customer A:" jump-target=common-in-clean
  add action=jump bgp-as-path="^(65535_)+\$" chain=CustomerA-in jump-target=common-in-client prefix=10.0.0.0/22 prefix-length=22-32
  add action=discard chain=CustomerA-in

  add bgp-communities=64512:0 chain=common-in-clean comment="Shared jump targets, clear communities where they contain ours:" set-bgp-communities=""
  add bgp-communities=64512:500 chain=common-in-clean set-bgp-communities=""
  add bgp-communities=64512:3000 chain=common-in-clean set-bgp-communities=""
  add bgp-communities=64512:4000 chain=common-in-clean set-bgp-communities=""

  add action=accept append-bgp-communities=64512:500 bgp-communities=64512:999 chain=common-in-client comment="Shared jump targets, append bgp-community=64512:500 (blackhole) where community=64512:999:" prefix-length=32 set-type=blackhole
  add bgp-communities=64512:999 chain=common-in-client comment="clear communities where community=64512:999:" set-bgp-communities=""
  add action=accept append-bgp-communities=64512:3000,64512:4000 chain=common-in-client comment="append bgp-community=64512:3000 & 64512:4000, set local-pref=250:" prefix-length=0-24 set-bgp-local-pref=250