Where basic BGP is about neighbors and exchanging routes, advanced BGP is about scalability and granular control. The three pillars: scaling (route reflectors, aggregation), protection (maximum prefix) and policy control (prefix-lists, route-maps, regex, communities, PBR).
1. Scaling iBGP – Route Reflectors
The challenge: split horizon & full mesh. In iBGP, a route learned from an iBGP neighbor must not be forwarded to another iBGP neighbor. Consequence: every router needs a direct session with every other router (full mesh). Sessions grow as N×(N−1)/2 – 20 routers = 190 sessions: unsustainable.
The solution – Route Reflector (RR): a router configured to bypass split horizon in a controlled way.
- RR server: receives routes from clients and reflects them to all other peers (clients and non-clients)
- RR client: a normal BGP peer that only peers with the RR server and is unaware of the RR function
- Design: mesh → hub-and-spoke, drastically fewer sessions
Loop prevention (critical): two attributes are added to reflected routes:
- Originator_ID: router-ID of the router that originally created the route in the AS – receiving a route with your own ID → drop
- Cluster_List: list of RR cluster-IDs the route passed – own cluster-ID present → drop
router bgp 65001
neighbor 10.1.1.2 remote-as 65001
neighbor 10.1.1.2 route-reflector-client
2. Route aggregation
Purpose: shrink the global routing table by merging many specifics (/24) into one aggregate (/16) – saves memory and CPU.
- Atomic aggregate: a flag telling the receiver that specific-path information was lost
- AS-set: forces the router to include all AS numbers from the original routes in the summary (in curly braces) – critical for loop prevention, since routers can then see their own AS inside the aggregate
router bgp 65001
address-family ipv4
aggregate-address 172.16.0.0 255.255.0.0 summary-only as-set
! summary-only suppresses the specifics, as-set preserves the AS-path
3. Protection: maximum prefix
Protects the router from a misconfigured neighbor or attack sending an overwhelming number of routes (e.g. the full internet table) → memory exhaustion and crashes.
router bgp 65001
neighbor 10.1.1.2 maximum-prefix 1000 80
! shut the session above 1000 routes, warn at 80 % (800 routes)
Result: exceeding the limit shuts the session, the neighbor goes to Idle (PfxCt). Reopening needs manual intervention or the restart parameter.
4. Filtering toolbox
IP prefix-lists (precision)
Unlike ACLs, prefix-lists match on both network and mask length. Read top-down, first match wins, implicit deny-all at the bottom.
ge(greater or equal): mask must be at least this longle(less or equal): mask must be at most this long10.0.0.0/8→ matches ONLY exactly 10.0.0.0/80.0.0.0/0 le 32→ matches EVERYTHING (any)10.0.0.0/8 ge 16 le 24→ all subnets inside 10/8 with masks between /16 and /24
Regular expressions (AS-path filtering)
| Token | Meaning | Example | Explanation |
|---|---|---|---|
| ^ | Start of string | ^65001 |
Starts with 65001 (direct neighbor) |
| $ | End of string | 65001$ |
Ends with 65001 (origin) |
| _ | Space/comma | _65001_ |
Through 65001 (transit) |
^$ |
Empty string | ^$ |
Locally originated route (own AS) |
5. Manipulation: route-maps & communities
Route-maps
If-then logic: a match condition plus a set action. Implicit deny-all at the end. permit 10: matches, performs the action and allows the route; deny 10: matches and drops the route (filtering).
Communities (tags)
Logically group routes across the network with a 32-bit tag, format AS:value (e.g. 65001:100).
- No_export: the route must not leave the AS (not sent to eBGP peers)
- No_advertise: must not be forwarded to any peer
- Critical detail: communities are not sent by default –
neighbor x.x.x.x send-communityis required
6. Policy Based Routing (PBR)
Normal routing looks only at the destination IP; PBR routes based on the source IP. Implemented with a route-map applied on the inbound interface. Use case: send guest Wi-Fi over the cheap internet link and corporate data over the dedicated MPLS line, same destination.
Recipe: (1) create an ACL matching the source traffic, (2) route-map with match ACL + set ip next-hop, (3) enable: ip policy route-map NAME.
7. Combined scenario (best practice)
Goal: block unwanted networks, tag important routes, and never act as a transit AS.
! 1. Prefix-list filtering (deny a specific network)
ip prefix-list BLOCK_BAD seq 5 deny 10.10.10.0/24
ip prefix-list BLOCK_BAD seq 10 permit 0.0.0.0/0 le 32
! 2. AS-path list (only routes ORIGINATING at the neighbor)
ip as-path access-list 1 permit _65002$
! 3. Inbound route-map
route-map INBOUND_POLICY permit 10
match ip address prefix-list BLOCK_BAD
match as-path 1
set local-preference 200
set community 65001:99
!
route-map INBOUND_POLICY permit 20
! empty permit allows remaining traffic with defaults
! 4. Apply on the neighbor
router bgp 65001
neighbor 10.1.1.2 remote-as 65002
neighbor 10.1.1.2 route-map INBOUND_POLICY in
neighbor 10.1.1.2 send-community
! 5. Aggregation with loop protection
aggregate-address 192.168.0.0 255.255.0.0 summary-only as-set
Gotchas ⚠️
- Soft reconfiguration: filter changes don’t take effect immediately – use
clear ip bgp * soft into refresh without resetting the session - Order of operations: prefix-lists are sequential – a deny before a permit for the same range blocks it
- Transit AS: without correct filters (e.g.
^$on outbound eBGP) your AS risks carrying transit traffic for the global internet - Case sensitivity: route-map names are case sensitive – a typo means everything is filtered out (implicit deny)