HackMyIP
← back to sheets

What Is BGP (Border Gateway Protocol)?

~/sheets/what-is-bgp.md
1

The Protocol That Holds the Internet Together

2

The internet is not one network, it is tens of thousands of separate networks that have to agree on how to reach each other. BGP, the Border Gateway Protocol, is how they do it. Each network, identified by an ASN, uses BGP to announce which blocks of IP addresses it can deliver to, and to learn the same from its neighbors. By exchanging these announcements, every network builds a map of paths to reach every other network. BGP is often called the routing protocol of the internet because without it the separate networks could not find one another.

3

You can see which ASN and network any address belongs to with our ASN Lookup or WHOIS Lookup, which is the network layer BGP operates on.

4

How BGP Works

5

BGP is a path-vector protocol. Instead of just advertising a destination, a network advertises the full sequence of ASNs that traffic would cross to get there. When a router has several possible paths to the same address block, it uses policy and the path information to choose one, preferring routes that match its agreements with neighbors. BGP sessions run over TCP on port 179, and once established, two routers exchange routes and then send only incremental updates as things change. The result is a constantly maintained, distributed picture of how to reach hundreds of thousands of address blocks.

6

BGP vs ASN

7

They work together but are different things. An ASN is the identifier for a network, the autonomous system. BGP is the protocol those networks speak to exchange routes. Put simply, the ASN is the name of a participant and BGP is the language they use to tell each other which addresses they can reach. A BGP announcement always carries ASNs in it, because the path it describes is a list of the networks the traffic would pass through.

8

iBGP vs eBGP

9

BGP runs in two modes. eBGP (external BGP) is used between routers in different autonomous systems, for example between two ISPs, and it is how networks under separate control exchange routes. iBGP (internal BGP) is used between routers within the same autonomous system to carry that external routing information consistently across a large network. eBGP connects you to the rest of the internet, while iBGP keeps a single large network in agreement internally about what it has learned.

10

What Is BGP Hijacking?

11

Because BGP largely trusts the announcements it receives, a network can announce address blocks it does not actually own, and other networks may believe it and send that traffic the wrong way. This is BGP hijacking, and it can redirect or black-hole traffic, sometimes through misconfiguration and sometimes maliciously. Defenses such as route filtering and the RPKI system, which lets networks cryptographically prove which ASN is allowed to announce a block, exist to reduce it. BGP hijacking matters because it can disrupt or intercept traffic at internet scale.

12

Frequently Asked Questions

13

What is BGP (Border Gateway Protocol) and how does it work?

14

BGP is the routing protocol that holds the internet together by letting separate networks exchange reachability. Each network, identified by an ASN, announces which blocks of IP addresses it can deliver to and learns the same from neighbors, building a map of paths across the internet. It is a path-vector protocol that advertises the full sequence of networks to a destination, and it runs over TCP on port 179.

15

What is the difference between BGP and an ASN?

16

An ASN is the identifier for a network, the autonomous system, while BGP is the protocol those networks speak to exchange routes. The ASN is the name of a participant and BGP is the language they use to tell each other which addresses they can reach. A BGP announcement always carries ASNs, because the path it describes is a list of the networks traffic would cross.

17

What is BGP hijacking?

18

BGP hijacking is when a network announces IP address blocks it does not actually own, and other networks believe it and send that traffic the wrong way. It can redirect or black-hole traffic, through either misconfiguration or malicious intent. Defenses such as route filtering and RPKI, which lets networks cryptographically prove which ASN may announce a block, exist to reduce it.

19

What is the difference between iBGP and eBGP?

20

eBGP, or external BGP, runs between routers in different autonomous systems, such as between two ISPs, and is how separately controlled networks exchange routes. iBGP, or internal BGP, runs between routers within the same autonomous system to carry that routing information consistently across a large network. eBGP connects a network to the rest of the internet, while iBGP keeps one network internally consistent.

21

Why is BGP important for the internet?

22

BGP is important because the internet is tens of thousands of separate networks that must agree on how to reach each other, and BGP is the protocol that makes that possible. Without it, networks could not learn paths to one another and global connectivity would break. Its trust-based design is also why routing problems like BGP hijacks can have wide impact.

23
Last updated: April 2026