Networks of networks
The internet is tens of thousands of separate networks, each run by one organization with its own rules. They are internet providers, content networks, universities, and companies. Each of them is an A network run by one organization. It has its own routing policy and its own AS number., or AS.
AS numbers and address blocks
Every AS has an AS number, an ASN. Other networks tell yours apart by it.
Five regional internet registries hand out AS numbers and address blocks, each for a part of the world:
| Registry | Region |
|---|---|
| AFRINIC | Africa |
| APNIC | Asia and the Pacific |
| ARIN | Canada, the United States, and parts of the Caribbean |
| LACNIC | Latin America and parts of the Caribbean |
| RIPE NCC | Europe, the Middle East, and parts of Central Asia |
In some countries, a national registry sits between you and the regional one. A network usually gets its own AS number when it has a routing policy of its own. That mostly means it connects to more than one other network.
Addresses come in two kinds:
- From your provider. The addresses your internet provider lends you are part of its block. If you change provider, you give them back and change every address in your network.
- Your own. A block that a registry gives to you is often called provider-independent space. It goes with you to any provider, and you announce it yourself.
Some AS numbers are set aside, as the private IPv4 ranges are:
| Numbers | Set aside for |
|---|---|
| 64496 to 64511, 65536 to 65551 | Documentation, such as this course. |
| 64512 to 65534 | Private use inside a network, never seen on the internet. |
| 4200000000 to 4294967294 | Private use too. The largest AS number is 4294967295. |
Transit and peering
Transit is what a home or office buys from its internet provider, at a larger scale. The customer pays, and the provider carries the customer's traffic to and from the rest of the internet. It tells every other network how to reach the customer, and tells the customer how to reach everyone. Transit is usually paid for by the amount of traffic, or as a fixed price for the port.
Peering is an agreement between two networks to send each other the traffic for their own addresses and their customers' addresses, and nothing else. Neither one is paid to carry the other's traffic to the rest of the internet. Both save money on traffic that would otherwise cross a transit provider, and the path is often shorter.
That difference decides how routes travel. By convention, and because of who pays:
- A network passes the routes of its customers on to everyone: its providers, its peers, and its other customers. Carrying traffic for customers is what it is paid for.
- A network passes the routes it learns from its providers and peers only on to its own customers. Carrying traffic between two networks that don't pay it would cost it money and earn it nothing.
A handful of very large networks buy transit from nobody. They peer with each other, and between them they reach everyone.
Buy transit from Hurricane Electric, and see what you can reach. Then remove that link, and only peer with Cogent.
Your network has no links yet. Give it a transit provider or a peer.
| To | The way |
|---|---|
| Hurricane Electric, AS6939 | no route |
| Cogent, AS174 | no route |
| Akamai, AS20940 | no route |
| Netflix, AS2906 | no route |
- Hurricane Electric and Cogent peer.
- Akamai buys transit from Hurricane Electric.
- Netflix buys transit from Cogent.
Who pays whom
- Your network pays nobody, and is paid by nobody.
- Hurricane Electric pays nobody, and is paid by Akamai.
- Cogent pays nobody, and is paid by Netflix.
- Akamai pays Hurricane Electric, and is paid by nobody.
- Netflix pays Cogent, and is paid by nobody.
With only a peering link to Cogent, you reach Cogent and its customer, Netflix. You don't reach Hurricane Electric or its customer, because Cogent learned their routes from a peer. By rule 2, Cogent passes those routes only to its customers, and you are a peer. To reach everything, you need at least one transit provider, or peers that cover everyone, which only the largest networks have.
Internet exchanges
Peering needs a cable between two networks. A separate cable to every network you peer with doesn't scale. So networks meet at an A place where many networks connect to one shared network, so each can peer with any other over a single port., an IX. The exchange runs one shared network, the peering LAN, often in a data center where many networks already have routers. Each member plugs one port into it and gets an address on it. Then it can reach every other member over that one port.
Two members still need a A connection two routers keep open to exchange routes, such as a BGP session. between their routers to tell each other their routes. Setting one up with every member, one by one, adds up fast. So most exchanges run a A server at an internet exchange that takes the routes of every member and passes them on to every other member. Each member then needs one session instead of hundreds.. Each member keeps one session with it, and it passes every member's routes on to every other member.
Add networks, then turn the route server on.
- Sessions each network keeps
- 5
- Sessions in all
- 15
A network that joins next has to set up 6 new sessions, each agreed with another network.
Without a route server, the sessions grow far faster than the members. At an exchange of 300 networks, a session between every pair would be 44,850 sessions. With a route server, it is 300. Many exchanges run two route servers, so that one can be down for maintenance, and members keep a session with each.
PeeringDB
To peer with a network, you need to know where it is. PeeringDB is a free public database where networks list the exchanges and data centers they are at. They also list their AS number, their address on each peering LAN, and how to ask them to peer. Before you join an exchange, look up who is already there.
Networks of networks in Circuit
Your AS number belongs to the whole network, so it goes in circuit.ts. Every BGP session of every device uses it, unless a device writes another:
export const as64500 = circuit({
asn: 64500,
sites: {
"pop-1": { description: "Where the router meets the transit and the exchange" },
},
});The interface on an exchange's peering LAN can say which exchange it is, with exchange. Circuit writes nothing to the device for it. circuit sync peeringdb publishes it to your record at PeeringDB:
interfaces: {
vlan_interface: {
exchange: {
vlan: "exchange",
addresses: ["192.0.2.10/24", "2001:db8:ffff::10/64"],
exchange: { name: "DE-CIX Frankfurt", speed: 10_000 },
},
},
},speed is your port's speed in Mbit/s.