BGP (Border Gateway Protocol)
About 5 min read
Last updated: 2026-08-14
What Is BGP
BGP (Border Gateway Protocol) is the protocol that different networks, called autonomous systems (ASes), use to exchange routing information across the internet. The internet consists of tens of thousands of ASes interconnected with each other, and BGP is responsible for communicating which paths lead to which networks at each interconnection point.
When you access a website, your packets traverse multiple ISP and carrier networks to reach their destination. BGP is what determines this path. If BGP stops functioning correctly, packets cannot reach their destinations, and communication across large parts of the internet can be disrupted. Often called the "road signs of the internet," BGP is a protocol that underpins global routing.
AS Numbers and Route Selection
An AS (Autonomous System) is a collection of networks operated by a single administrative entity. AS numbers (ASNs) are handed out through a hierarchy: IANA distributes blocks to the regional internet registries (RIRs), and each RIR assigns numbers to organizations in its region. APNIC covers the Asia-Pacific region, including Japan. For example, Google operates AS15169 and Amazon operates AS16509.
BGP routers connect to neighboring AS routers via TCP port 179 and advertise the network prefixes (IP address ranges) they can reach. The receiving router evaluates multiple candidate routes based on attributes such as AS path length, local preference, and MED (Multi-Exit Discriminator) to select the optimal path.
BGP route selection is not simply shortest-path routing. It reflects business relationships (peering, transit), cost considerations, and traffic engineering policies.
BGP Hijacking - When Routes Get Stolen
A BGP hijack occurs when an attacker illegitimately advertises IP prefixes that do not belong to them, diverting traffic to their network. The authentication required by the base BGP specification (RFC 4271) protects the TCP connection between neighboring routers but does not verify the legitimacy of the advertised routes, so without filtering or other safeguards, malicious announcements can propagate.
- 2008 YouTube Incident: A Pakistani ISP advertised a more specific route (/24) for YouTube's IP prefix, causing YouTube traffic worldwide to be routed to Pakistan. According to RIPE NCC's analysis, the main events were over in about 2 hours.
- 2018 Amazon Route 53 Incident: A BGP hijack redirected traffic for Amazon's DNS service to attackers, who used it to direct users of a cryptocurrency wallet service to phishing sites, where their funds were stolen.
- 2021 Facebook Outage: A maintenance command took down all connections in Facebook's backbone network, after which its DNS servers withdrew their BGP route advertisements, making Facebook, Instagram, and WhatsApp inaccessible worldwide (according to Meta's engineering blog).
BGP hijacks occur not only as deliberate attacks but also as accidents caused by operator misconfiguration (route leaks). In 2019, a route leak caused some European traffic to be rerouted through a Chinese carrier.
RPKI - Cryptographic Route Validation
RPKI (Resource Public Key Infrastructure) is a framework for cryptographically verifying that BGP route advertisements originate from authorized ASes. IP prefix holders issue ROAs (Route Origin Authorizations) declaring which AS is authorized to advertise a given prefix.
BGP routers compare received route advertisements against ROAs and classify them into three states:
Cloudflare's list (isbgpsafeyet.com, as of October 2026) shows Cloudflare (AS13335) and Amazon (AS16509) rejecting RPKI Invalid routes, and Google (AS15169) doing so partially. However, RPKI only protects prefixes that have a ROA. Routes without one stay in the Not Found state and are accepted as before, so while ROA coverage remains partial, origin validation alone cannot stop hijacking. Combining RPKI with IRR filtering and BGPsec is recommended as further defense layers.
BGP and Your Everyday Internet Experience
While regular users never interact with BGP directly, its operation significantly affects internet experience. Whether an ISP optimizes its BGP routing can make a noticeable difference in access speeds to overseas websites, even on the same connection plan.
Cross-referencing the hop addresses from a traceroute command with whois or AS lookup data reveals the ASes your packets traverse.
When a major BGP incident occurs, entire regions or services can "disappear" from the internet. BGP routing data is publicly available in real time through projects like RIPE RIS and RouteViews, which are used to detect network outages and hijacking attempts, supporting internet transparency.
Common Misconceptions
- BGP determines internet speed
- BGP determines which path traffic takes, not the bandwidth or speed of the connection itself. However, route selection indirectly affects latency and throughput by determining how many ASes packets traverse and the quality of those networks.
- BGP hijacking requires advanced technical skills
- Where upstream filtering or RPKI validation is not in place, a network operator with an AS number can execute a BGP hijack simply by sending an illegitimate route advertisement, because the base BGP specification does not verify the legitimacy of advertised routes. BGP hijacks also occur as accidental misconfigurations, not only as deliberate attacks.
- RPKI completely prevents BGP hijacking
- RPKI verifies the origin AS of a route but cannot detect tampering with the AS path itself. Prefixes without ROAs remain unprotected. RPKI is an important defense layer but does not provide complete protection on its own.