eBGP with FRR and prefix lists

Advertise your prefix and accept a default route from a single upstream.

This example advertises one /24 to one upstream. An outbound list limits what FRR can announce. An inbound list limits what it accepts.

router bgp 64512
 bgp router-id 192.0.2.1
 no bgp default ipv4-unicast
 neighbor 203.0.113.1 remote-as 64500
 neighbor 203.0.113.1 description upstream
 !
 address-family ipv4 unicast
  network 192.0.2.0/24
  neighbor 203.0.113.1 activate
  neighbor 203.0.113.1 prefix-list OUT out
  neighbor 203.0.113.1 prefix-list IN in
  neighbor 203.0.113.1 maximum-prefix 1000 90
 exit-address-family
!
ip prefix-list OUT seq 10 permit 192.0.2.0/24
ip prefix-list IN  seq 10 permit 0.0.0.0/0
!
ip route 192.0.2.0/24 blackhole

How the filters work

  • The static blackhole route puts your prefix in the local routing table so the BGP network statement can originate it.
  • The outbound list allows your own prefix and keeps the router from advertising other routes as transit. The explicit list also makes the policy visible when reviewing the configuration.
  • The inbound list accepts only a default route. A small edge router with one upstream can often work without a full table.
  • maximum-prefix limits the number of prefixes accepted from the peer.

Verification

vtysh -c "show bgp summary"
vtysh -c "show bgp ipv4 neighbors 203.0.113.1 advertised-routes"
vtysh -c "show bgp ipv4 neighbors 203.0.113.1 received-routes"

FRR needs soft-reconfiguration inbound for received-routes to display routes that were filtered out.