Multi-homed BGP anycast routing announces the same /24 IPv4 (or /48 IPv6) prefix simultaneously from multiple geographically distributed bare-metal server nodes under your Autonomous System Number (ASN). Upstream Tier-1 transit routers direct client packets automatically to the topologically closest healthy node via BGP best-path selection, absorbing volumetric DDoS floods locally at each edge PoP while enabling automated sub-minute failover using BFD health probes, RPKI ROA route origin validation, and provider BGP blackhole/scrubbing communities.
Single-homed servers bound to a single transit carrier fail completely when fiber cuts occur or when upstream congestion degrades packet delivery across global peering exchanges. By combining multi-homed BGP transit with IP anycast announcements on bare-metal servers, infrastructure teams eliminate single-PoP chokepoints, slash user latency for stateless and DNS/CDN workloads, and contain volumetric DDoS attacks within regional transit boundaries instead of letting a single flood topple every customer worldwide.
Eliminate single-ISP outages by announcing PI/PA prefixes across multiple Tier-1 transit peers and IXPs.
Localize DDoS floods to the nearest PoP while healthy edge nodes keep serving unaffected global traffic.
Prevent route hijacks with ROA validation and trigger upstream RTBH or scrubbing via BGP communities.
1. BGP-4 Path Selection & Anycast Topology Fundamentals
Defined in RFC 4271 (Border Gateway Protocol 4), BGP exchanges Network Layer Reachability Information (NLRI) between Autonomous Systems. In unicast routing, a prefix exists in one location. In IP anycast, identical /24 IPv4 and /48 IPv6 prefixes are originated from three to dozens of independent bare-metal edge nodes running FRRouting (FRR) or BIRD over BGP sessions to local top-of-rack routers. Global routers pick the shortest AS-path or lowest MED/IGP cost, naturally steering clients to the closest healthy PoP.
Why Dedicated Bare-Metal Beats Virtual Instances for BGP Edge Nodes
Virtual cloud instances routinely block raw BGP announcements, restrict spoofed/loopback VIP bindings, or impose steep per-gigabyte egress charges during traffic spikes. As detailed in our bare-metal vs. cloud VPS hosting performance analysis, dedicated servers provide native access to 10GbE/25GbE NIC queues, full kernel routing tables (over 950,000+ IPv4 DFZ prefixes in Linux FIB), and predictable unmetered or high-commit transit ports required for reliable BGP peering.
- Minimum prefix sizes: Global DFZ filters drop announcements longer than
/24(IPv4) or/48(IPv6); always announce aggregated boundary blocks. - Anycast loopback binding: Bind the anycast service IP to
loor a dummy interface (ip addr add 198.51.100.10/32 dev dummy0) so services stay bound independently of physical NIC link flaps. - ECMP & TCP caveats: Stateful TCP over anycast works reliably across stable BGP topologies, though mid-stream BGP convergence shifts can reset long-lived TCP sockets unless consistent hashing or QUIC connection IDs are used.
2. Configuring FRRouting (FRR), Route Filters & RPKI Validation
Running BGP safely on a Linux edge host demands strict inbound and outbound prefix-list filters—never become an accidental transit AS by leaking routes learned from Carrier A to Carrier B. Pair outbound prefix-lists with RPKI Route Origin Validation (ROV) via Routinator or StayRTR so your node automatically rejects RPKI-invalid hijacked prefixes and ensures your own ASN has signed ROAs published in your Regional Internet Registry (ARIN, RIPE, APNIC, LACNIC, or AFRINIC).
! /etc/frr/frr.conf - Multi-homed edge BGP with strict filters & BFD
router bgp 64512
bgp router-id 203.0.113.10
bgp graceful-restart
bgp log-neighbor-changes
no bgp ebgp-requires-policy
neighbor 192.0.2.1 remote-as 174
neighbor 192.0.2.1 description Transit-Carrier-A
neighbor 192.0.2.1 bfd
neighbor 192.0.2.5 remote-as 3356
neighbor 192.0.2.5 description Transit-Carrier-B
neighbor 192.0.2.5 bfd
!
address-family ipv4 unicast
network 198.51.100.0/24
neighbor 192.0.2.1 prefix-list OWN_PREFIX_OUT out
neighbor 192.0.2.1 route-map TRANSIT_A_IN in
neighbor 192.0.2.5 prefix-list OWN_PREFIX_OUT out
neighbor 192.0.2.5 route-map TRANSIT_B_IN in
maximum-paths 2
exit-address-family
!
ip prefix-list OWN_PREFIX_OUT seq 10 permit 198.51.100.0/24
ip prefix-list OWN_PREFIX_OUT seq 20 deny any
3. Anti-DDoS Traffic Engineering, Communities & BFD Failover
BGP traffic engineering allows operators to steer flows without hardware swaps. Use local-preference to steer outbound egress toward your lowest-latency or cheapest transit peer, and apply cautious AS-path prepending or granular BGP communities (such as 65535:666 for Remotely Triggered Black Hole [RTBH] or provider-specific scrubbing-center communities) to shift inbound traffic dynamically. Understand how BGP signaling pairs with inline scrubbing appliances in our DDoS protection infrastructure guide.
Sub-Second Health Withdrawal via BFD & Healthcheck Daemons
Default BGP hold timers (90 to 180 seconds) leave users timing out for three minutes when an edge daemon crashes while the physical NIC stays up. Run Bidirectional Forwarding Detection (BFD) for sub-second link-failure detection alongside an application-aware watchdog (ExaBGP or anycast-healthchecker) that verifies Nginx/DNS/QUIC responses locally every 2 seconds and withdraws the /24 announcement cleanly if the service degrades. Meanwhile, tune TCP delivery on the healthy edge paths using our TCP BBR Linux congestion control guide.
Rollback & Safety Precaution: Never apply radical AS-path prepends (more than 3–4 repeats) or withdraw an active prefix across all PoPs simultaneously without verifying an active fallback route; excessive prepending frequently causes suboptimal transoceanic tromboning rather than clean regional balance. Test outbound route-map edits via vtysh -c 'show ip bgp neighbors 192.0.2.1 advertised-routes' immediately and verify your RPKI ROAs before announcing any new subnet.
4. Comparing Routing & Mitigation Architectures on Bare Metal
Different workloads require distinct routing strategies depending on connection statefulness, DDoS threat profile, and budget for global PoP presence.
| Routing Architecture | Failover Convergence | DDoS Containment Model | TCP / Stateful Affinity | Ideal Workload |
|---|---|---|---|---|
| Single-Homed Unicast | Manual or ISP-dependent | Null-route or single-ISP scrubbing | 100% deterministic | Internal staging or single-region apps |
| Multi-Homed Unicast | 1 – 90 sec (BFD/BGP) | Carrier-selective diversion / Flowspec | Deterministic per session | SaaS backends, databases, enterprise APIs |
| Global BGP Anycast | Sub-10 sec via local withdrawal | PoP-isolated blast radius | Stable if paths steady (QUIC best) | DNS authoritative, CDN edge, DDoS proxies |
| On-Demand BGP Scrubbing | 15 – 45 sec diversion | Clean return via GRE/IP-in-IP tunnel | Preserved across scrubbing tunnel | Latency-sensitive gaming & fintech |
5. BGP Telemetry, Looking Glasses & Production Deployment Checklist
Operating your own ASN and BGP sessions turns network observability into a continuous engineering discipline. Collect sFlow or NetFlow telemetry from your edge servers and routers, alert on RPKI validation state changes, and validate propagation continuously against public RIPE RIS and RouteViews looking glasses.
- Verify IRR & LOA paperwork: Publish updated
route/route6IRR objects (RADb/RIPE) and sign Letters of Authorization (LOA) for each data-center transit port. - Protect BGP TCP port 179: Enable TCP MD5 or GTSM (TTL security,
ttl-security hops 1) on every eBGP session and restrict port 179 in nftables strictly to peer IPs. - Monitor asymmetric ingress/egress: Watch Flowspec and per-peer byte counters so a congested transit port never drops return packets silently.
Frequently Asked Questions
Do I need my own ASN and /24 IPv4 block to run BGP anycast?
Yes. Global internet routing requires an Autonomous System Number (ASN) and Provider-Independent (PI) or leased /24 IPv4 (and/or /48 IPv6) prefix with RPKI ROAs and IRR route objects authorized by the IP holder.
Does BGP anycast break stateful TCP and HTTPS connections?
Under normal steady-state conditions, BGP routes remain stable long enough for HTTPS, HTTP/2, and HTTP/3 sessions to complete cleanly. Only rare mid-session path changes across PoPs drop TCP state, which stateless UDP/QUIC or edge-terminated proxies connecting back to origin over private tunnels solve cleanly.
Which Linux routing daemon is better for BGP on bare metal: FRRouting or BIRD?
Both are production-grade. FRRouting (FRR) provides Cisco-like vtysh CLI syntax, native EVPN/VXLAN and BFD support, and intuitive route-maps; BIRD excels in ultra-fast route-server table convergence and compact programmatic filter scripting.
What is the difference between RTBH (blackhole) and BGP Flowspec?
Remotely Triggered Black Hole (RTBH) drops all traffic to a targeted /32 IP at the upstream router—taking the IP offline to save the rest of your subnet. BGP Flowspec distributes granular L3/L4 rules (e.g., drop UDP port 1900 >1000B) so legitimate HTTP/TCP traffic stays online.
How many global servers do I need for effective BGP anycast DDoS defense?
Even two to four well-peered bare-metal locations across major transit hubs create substantial topological separation, ensuring an attack originating near one region gets absorbed at the nearest PoP without saturating your other locations.
Can I run BGP anycast directly from a Linux server without dedicated hardware routers?
Yes. Provided your dedicated server provider establishes an eBGP session from their top-of-rack switch to your server’s NIC IP and permits your /24 prefix through their IRR filters, FRR or BIRD handles full BGP peering natively on Linux.
Launch dedicated servers with BGP session support, high-capacity 10Gbps uplinks, and multi-carrier Tier-1 routing built for resilient global traffic engineering.
