All guides
Term

BGP

A standardized exterior gateway protocol designed to exchange routing and reachability information among autonomous systems (AS) on the Internet.

BGP (Border Gateway Protocol) is a standardized exterior gateway protocol designed to exchange routing and reachability information among autonomous systems (AS) on the Internet. Operating as a path-vector protocol over TCP port 179, it connects independent networks managed by ISPs, cloud providers, universities, and large enterprises. By advertising which IP address blocks each network can reach, BGP serves as the core routing mechanism that binds disparate networks into a single global internet.

How it works

BGP routers establish explicit peering sessions with neighboring routers to exchange IP prefixes. Unlike interior routing protocols that simply calculate the shortest physical distance or lowest latency, BGP relies on policy-based routing. Administrators control traffic flow by evaluating path attributes in a strict decision sequence:

  • eBGP (External BGP): Exchanges routing tables between different autonomous systems at network boundaries.
  • iBGP (Internal BGP): Distributes externally learned routes across routers inside the same AS.
  • AS_PATH: Records every AS number a route has traversed, preventing routing loops and serving as a basic hop-count tiebreaker.
  • LOCAL_PREF: Sets the preferred exit point for outbound traffic leaving a local network.
  • MED (Multi-Exit Discriminator): Suggests to neighboring networks which entry point to use when multiple links exist between two systems.

Session health relies on periodic Keepalive messages and a Hold-time expiration timer, commonly defaulting to 60 and 180 seconds. If a peer fails to respond before the hold timer expires, the router withdraws those routes and recalculates best paths across the global routing table, which holds well over 900,000 IPv4 prefixes.

Example

In a multi-homed hosting setup, an organization with its own Autonomous System Number (ASN) announces an IPv4 prefix to an upstream transit provider using a routing daemon like FRRouting or BIRD:

router bgp 65001
 bgp router-id 192.0.2.1
 neighbor 198.51.100.1 remote-as 64496
 !
 address-family ipv4 unicast
  network 203.0.113.0/24
  neighbor 198.51.100.1 route-map EXPORT-POLICY out
 exit-address-family

This configuration establishes an eBGP session from local AS 65001 to upstream peer 64496, advertising the 203.0.113.0/24 block while filtering outbound announcements through a route map.

What matters when choosing a server or hosting

When deploying dedicated servers, colocation, or bare-metal cloud instances, BGP capabilities directly affect network resilience and IP portability:

  • BYOIP and BGP sessions: Verify whether the provider allows you to bring your own IP space and establish eBGP sessions directly from your server or virtual router.
  • Transit blend and peering: Look for providers connected to multiple Tier-1 transit carriers and major Internet Exchange Points (IXPs) to minimize packet loss and latency.
  • DDoS mitigation support: Check if the host supports BGP communities for remote-triggered blackholing (RTBH) or Flowspec to drop volumetric attack traffic upstream before it saturates your port.
  • RPKI validation: Confirm that the network enforces Route Origin Validation (ROV) to block hijacked routes from reaching your infrastructure.

Common mistakes

  • Omission of prefix filters: Failing to filter inbound and outbound announcements can cause route leaks, accidentally turning your servers into a transit path for third-party internet traffic.
  • Missing RPKI ROAs: Advertising IP space without valid Route Origin Authorizations causes RPKI-enforcing networks to drop your prefixes as invalid.
  • Asymmetric routing issues: Advertising prefixes unevenly across multiple providers without accounting for stateful firewalls can result in dropped packets when outbound and inbound paths diverge.
  • Unauthenticated sessions: Leaving BGP peers open without TCP MD5 signatures or GTSM (TTL security) exposes sessions to spoofing and resets.

FAQ

Do I need my own ASN to use BGP?

For public internet routing across multiple providers, you need a public ASN and at least a /24 IPv4 or /48 IPv6 block assigned by a Regional Internet Registry. If you only connect to a single provider or use internal routing, a private ASN (such as 64512–65534) is sufficient.

What is BGP Anycast?

Anycast is a routing technique where multiple servers in different geographic locations announce the exact same IP prefix via BGP. Internet routers automatically direct each user to the topologically nearest server, improving latency and absorbing DDoS traffic.

How fast does BGP recover from a link failure?

Default timers can take up to three minutes to detect a silent link failure. However, combining BGP with Bidirectional Forwarding Detection (BFD) reduces failure detection and route convergence to under a second.

All glossary terms

Glossary

Related terms

Full glossary

New guides every week.

A digest of the best pieces on servers, VPN and self-hosted software. No ads, no spam.

1 email a weekOne-click unsubscribeRU · EN
Only slipjar.app articles, nothing else.