---
title: "What is BGP: how the internet picks the path between you and a server | StreetHosting"
description: "Learn what BGP, autonomous systems (ASN), peering, transit and IX.br are, why your ISP's route changes your ping and how to look up routes with whois and mtr."
url: "https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing"
type: "page"
language: "en-US"
---

Infrastructure · 10 min · Advanced

Published on Nov 13, 2026 · Updated on Nov 13, 2026

# BGP in practice: autonomous systems, routes and why your ISP changes your ping

The internet is a network of networks, and BGP is the protocol those networks use to agree on where traffic goes. Knowing the basics explains why the same server has a different ping on each ISP and how to investigate it.

By [Equipe StreetHosting](https://streethosting.com.br/en/autores#equipe-streethosting) · StreetHosting infrastructure and support team

[Latency and ping](https://streethosting.com.br/en/guides/topics/latency)

Summarize with:

[](https://chat.openai.com/?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Finfrastructure%2Fwhat-is-bgp-internet-routing.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "ChatGPT") [](https://claude.ai/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Finfrastructure%2Fwhat-is-bgp-internet-routing.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Claude") [](https://www.google.com/search?udm=50&aep=11&q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Finfrastructure%2Fwhat-is-bgp-internet-routing.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Google AI Mode") [](https://x.com/i/grok?text=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Finfrastructure%2Fwhat-is-bgp-internet-routing.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Grok") [](https://www.perplexity.ai/search/new?q=Summarize%20the%20key%20points%20of%20this%20StreetHosting%20guide%3A%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Finfrastructure%2Fwhat-is-bgp-internet-routing.%20Highlight%20the%20step-by-step%20instructions%2C%20the%20prerequisites%20and%20the%20most%20common%20mistakes. "Perplexity")

Share:

[](https://x.com/intent/tweet?text=What%20is%20BGP%3A%20how%20the%20internet%20picks%20the%20path%20between%20you%20and%20a%20server&url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Finfrastructure%2Fwhat-is-bgp-internet-routing "Share on X") [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Finfrastructure%2Fwhat-is-bgp-internet-routing "Share on Facebook") [](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Finfrastructure%2Fwhat-is-bgp-internet-routing "Share on LinkedIn") [](https://wa.me/?text=What%20is%20BGP%3A%20how%20the%20internet%20picks%20the%20path%20between%20you%20and%20a%20server%20https%3A%2F%2Fstreethosting.com.br%2Fen%2Fguides%2Finfrastructure%2Fwhat-is-bgp-internet-routing "Share on WhatsApp")

For agents: Copy as Markdown [.md](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing.md)

In this guide 7 sections

* [BGP and autonomous systems](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#o-que-e-bgp)
* [Prefixes and how a route is chosen](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#prefixos-e-escolha)
* [Why the route changes the ping](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#ping-e-rota)
* [Peering, transit and IX.br](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#peering-transito)
* [Route leaks and hijacks](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#vazamento-sequestro)
* [How to look up ASNs and routes](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#consultar)
* [What this changes for your server](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#onde-rodar)

Quick answer

**BGP** (Border Gateway Protocol) is the protocol the networks that make up the internet use to announce which IP blocks they can reach and to choose where to send traffic. Each network is an **autonomous system**, identified by a number called an **ASN**. The route your ISP picks to the server depends on commercial agreements and policy, not only on distance, which is why the ping to the same server changes from one ISP to another. You can see the path and the ASNs involved with `mtr -z`, `whois` and the bgp.he.net site.

## BGP and autonomous systems[](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#o-que-e-bgp)

The internet has no owner and no central map. It is the sum of tens of thousands of independent networks: ISPs, hosting providers, universities, content companies. Each one manages its own piece and sets its own routing rules. A network like that is called an **autonomous system** (AS), and each AS gets a number, the **ASN**, from a regional registry. In Latin America that registry is LACNIC, and in Brazil the request goes through Registro.br.

A few well-known ASNs help build familiarity: AS15169 is Google's, AS13335 is Cloudflare's and AS6939 is Hurricane Electric's. Every time your packet crosses the internet, it passes through several of these autonomous systems, one after another.

Inside each AS, the network uses its internal protocols to spread routes among its own routers. Between different autonomous systems, the only protocol in use is BGP. It runs over TCP, on port 179, between two neighboring routers that agree to exchange information. The version between different networks is called eBGP, and the version inside the same network, iBGP.

## Prefixes and how a route is chosen[](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#prefixos-e-escolha)

What BGP exchanges are announcements of **prefixes**, which are blocks of IPs. When an AS announces the prefix `203.0.113.0/24`, it is telling its neighbors it knows how to carry traffic to those 256 addresses. The neighbor passes the announcement on, adding its own number to the list, and so each route carries the **AS path**, the sequence of autonomous systems the traffic crosses to reach the destination.

`Prefix AS path (from your network to the destination) 203.0.113.0/24 64500 64501 64502 ^ ^ | owner of the prefix (origin) direct neighbor`

(The numbers above are ASNs reserved for documentation, which belong to no one.) The same prefix often arrives from several neighbors at once, each with its own AS path. The router has to pick one of them, and the criteria follow an order. In simplified form:

1. **Local preference:** a value the administrator sets. This is where money comes in: in general the ISP prefers routes learned from customers, who pay for them, then peering routes, which are free, and last transit routes, which it pays for.
2. **Shortest AS path:** among routes with the same preference, the one crossing fewer autonomous systems wins.
3. **Tiebreakers:** the origin of the route, the metric the neighbor suggests and, finally, the oldest neighbor or the one with the lowest identifier.

Before all of that there is one more rule: the most specific prefix always wins. If there are routes for a /22 and for a /24 inside it, the traffic follows the /24. This rule is the basis of route hijacking, which comes up below.

Notice what is not on the list: latency, packet loss and bandwidth. BGP measures none of that. It decides by policy and by counting hops between networks, and it only reacts to a failure when the neighbor stops announcing the route or the session with it goes down.

## Why the route changes the ping[](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#ping-e-rota)

Ping is mostly the signal's travel time, and the trip depends on the path BGP chose. The two scenarios below show how the same server in São Paulo can answer well on one ISP and badly on another:

* **Direct path:**your ISP and the server's network exchange traffic with each other in São Paulo, through peering. The packet leaves your home, reaches the exchange point and enters the server. Few hops and a low ping.
* **Long path:** the two networks have no direct agreement, and your ISP hands the traffic to a transit provider that goes through another city, or another country, before coming back. The server is in the same city, but the packet takes a detour of thousands of kilometers.

That detour explains complaints such as a high ping on only one ISP, or a ping that gets worse overnight with nothing changed on the server. Someone changed a preference, a transit contract, or a link went down and the backup route is worse. For the player or the end customer this shows up as lag, and how to read the problem is covered in [latency and ping on servers](https://streethosting.com.br/en/guides/infrastructure/what-is-latency-and-ping).

One more detail: the outbound and return paths can differ. Each network picks its own outbound route, so traffic from A to B and from B to A often do not pass through the same places. That is why anyone investigating a route needs to measure in both directions, as explained in the guide on [using MTR to diagnose the network](https://streethosting.com.br/en/guides/infrastructure/how-to-use-mtr).

## Peering, transit and IX.br[](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#peering-transito)

Two networks connect in two ways, and the difference is financial:

| Type    | Who pays                                                    | What the network reaches                           | Common effect on the path                 |
| ------- | ----------------------------------------------------------- | -------------------------------------------------- | ----------------------------------------- |
| Transit | The buyer pays the seller                                   | The whole internet, through the supplier's network | More hops, but it reaches any destination |
| Peering | Usually nobody, each side pays for its own part of the link | Only the customers of each side                    | A shorter and cheaper path                |

Connecting two routers to each other, each pair by its own cable or fiber, does not scale. That is why there are **internet exchange points**, also called PTT or IXP: a facility where dozens or hundreds of networks connect their routers to the same platform and can agree on peering with any of the others there.

In Brazil, the set of exchange points is **IX.br**, run by NIC.br, with presence in dozens of cities. The one in São Paulo is among the largest in the world by traffic volume and concentrates ISPs, large video platforms and content delivery networks. The closer your server is to an exchange point where your ISP is also present, the better the chance that the path is short.

## Route leaks and hijacks[](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#vazamento-sequestro)

BGP was designed on trust: when a neighbor announces a prefix, the others accept it. That produces two kinds of accident, which show up in news about the internet going down:

* **Route hijack:** a network announces a prefix that is not its own, or a more specific prefix than the owner announced. Since the more specific one wins, traffic starts going to it. It can be a mistake, as in 2008, when an ISP in Pakistan tried to block YouTube inside the country and the announcement leaked to the world, taking the site down for hours. It can also be an attack, to spy on or divert traffic.
* **Route leak:** a network passes on routes it should have kept to itself. A customer that learns routes from two suppliers and passes them from one to the other becomes, without meaning to, a transit path for traffic that is not its own. The small link gets a flood and connections slow down or drop.

There is also the opposite case, the route that disappears. In 2021 a configuration change made a large company stop announcing its own prefixes, and the world lost the path to it. In that case nothing was stolen, the announcements simply vanished.

The most common defenses are prefix filters on neighbors, the MANRS initiative, which brings together good routing security practices, and RPKI. With RPKI the owner of a block publishes a signed authorization, the ROA, saying which ASN may announce that prefix and up to what maximum length. Networks that do origin validation drop announcements that contradict the ROA.

You do not control the BGP of the ISPs, but you can protect what depends on you. If your service suffers when a route is diverted, sensitive traffic needs TLS and a valid certificate: diverting the path of an encrypted packet does not hand its content to the attacker.

## How to look up ASNs and routes[](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#consultar)

Four lookups answer most questions: who owns this IP, which prefixes this network announces, who it connects to, where your traffic is going and who owns each hop.

1. **bgp.he.net:**Hurricane Electric's BGP Toolkit. Type an IP, a prefix or a network name and see the ASN, the announced prefixes, the exchange points where it is present and the peering or transit neighbors. It is the fastest way to understand a network.
2. **Team Cymru whois:** answers, in the terminal, which ASN originates the IP and which prefix covers it.
3. **whois of the ASN:** shows the registered owner, the contacts and, in some registries, the published routing policy.
4. **mtr and traceroute with ASN:** the real path of your traffic, with the autonomous system number next to each hop.

`# who owns this IP? (note the space before -v, inside the quotes) whois -h whois.cymru.com " -v 8.8.8.8" # registered data of an ASN whois AS15169 # path with the ASN of each hop (20 cycle report, resolving AS) mtr -rwz -c 20 8.8.8.8 # the same with traceroute on Linux traceroute -A 8.8.8.8`

Read the mtr result looking for ASN changes along the path. Each change of number marks the point where the traffic passed from one network to another, and that is where latency jumps tend to show up. If the ping rises from 15 ms to 120 ms exactly when the ASN changes and the change is to a transit network on another continent, you found the detour. How to read the output is covered in [using traceroute to find routing problems](https://streethosting.com.br/en/guides/infrastructure/how-to-use-traceroute).

On Windows, tracert does not show the ASN. Copy the IP of each hop and look it up on bgp.he.net, or use WinMTR to save the report you will attach to the ISP ticket. When you open the ticket, bring the traceroute from both directions, the time and the ASN where the latency jumps: the ISP can act on its own route and almost never on other people's.

## What this changes for your server[](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#onde-rodar)

The route between your customer and the server is decided by the ISPs on each side, not by the plan you bought. What you control is where the server is. For a Brazilian audience, a machine in São Paulo starts from a place where the country's main networks exchange traffic, which raises the chance of a short path. No hosting can guarantee the route each ISP will choose, so it is worth testing with mtr from your audience's networks before you decide.

* **VPS:** the [StreetHosting VPS](https://streethosting.com.br/en/vps) plans are in São Paulo, with KVM virtualization, root access, AntiDDoS included and a dedicated IPv4. With root you install and run mtr and traceroute from the server to the customer, which is the measurement of the opposite direction that your home connection cannot reach. The Xeon VPS starts at R$ 26.00 per month.
* **Dedicated servers:** for workloads that keep high and constant traffic, the [dedicated servers](https://streethosting.com.br/en/dedicated) are also in São Paulo, with delivery within 6 days and 30 to 80 TB of traffic included.

To lower the ping for people far from the server, the next step is usually bringing content closer to the user with techniques such as [anycast](https://streethosting.com.br/en/guides/infrastructure/what-is-anycast), which uses BGP itself to announce the same IP from several places. For a practical tuning roadmap, see [how to reduce a server's ping in Brazil](https://streethosting.com.br/en/guides/infrastructure/reduce-game-server-ping-brazil).

In this guide

* [BGP and autonomous systems](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#o-que-e-bgp)
* [Prefixes and how a route is chosen](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#prefixos-e-escolha)
* [Why the route changes the ping](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#ping-e-rota)
* [Peering, transit and IX.br](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#peering-transito)
* [Route leaks and hijacks](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#vazamento-sequestro)
* [How to look up ASNs and routes](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#consultar)
* [What this changes for your server](https://streethosting.com.br/en/guides/infrastructure/what-is-bgp-internet-routing#onde-rodar)

## Frequently asked questions

What is an ASN?

It is the number that identifies an autonomous system, that is, a network with its own routing policy, such as an ISP, a hosting provider or a large company. It appears as AS followed by a number, for example AS15169, which belongs to Google. In Brazil, ASNs are handed out by Registro.br.

Does BGP always pick the fastest path?

No. BGP does not measure latency. It chooses by policy: each ISP prefers routes from customers, then from peering partners, then from paid transit, and only then looks at the length of the path in autonomous systems. So the chosen route can be longer and have a worse ping.

What is the difference between peering and transit?

With transit, one network pays another to carry its traffic to the rest of the internet. With peering, two networks exchange only the traffic of their own customers, usually without paying. Peering tends to give a shorter and cheaper path, and it happens a lot inside internet exchange points such as IX.br.

What is IX.br?

It is the set of internet exchange points (called PTT in Brazil) run by NIC.br in several Brazilian cities. ISPs, content providers and companies connect their routers there to exchange traffic directly, without going through a third party. The one in São Paulo is among the largest in the world by traffic volume.

How do I find the ASN of an IP?

On the bgp.he.net website, by typing the IP, or in the terminal with whois -h whois.cymru.com followed by a space, -v and the IP, all inside quotes. mtr with the -z option and traceroute with the -A option already show the ASN of each hop on the path.

Next step

See VPS plans

Root VPS in Brazil with NVMe and Anti-DDoS.

[See VPS plans](https://streethosting.com.br/en/vps)

[See dedicated servers Exclusive hardware in São Paulo with NVMe and Anti-DDoS.](https://streethosting.com.br/en/dedicated)

## Related guides

[Infrastructure Intermediate How to use traceroute to find routing problems Traceroute lists every router between you and the server and how long each one takes to answer. Read the right way, it shows whether the delay starts at your home, at your ISP, between networks or at the destination. 8 min Read guide](https://streethosting.com.br/en/guides/infrastructure/how-to-use-traceroute) [Infrastructure Intermediate How to use MTR to diagnose network problems MTR combines traceroute and ping and shows, hop by hop, where latency climbs and where packets get lost. The trick is knowing which loss is real and which is just a router rationing its replies. 8 min Read guide](https://streethosting.com.br/en/guides/infrastructure/how-to-use-mtr) [Infrastructure Beginner What is latency and ping on a server Latency and ping shape how fast your service feels to users and players. Understanding them helps you choose better infrastructure. 2 min Read guide](https://streethosting.com.br/en/guides/infrastructure/what-is-latency-and-ping)

[← Back to the Guide Center](https://streethosting.com.br/en/guides)
