Evan Pratten
Evan Pratten
Software Developer

I happened to be poking through the AMPRNet gateway list today, and pretty much out of nowhere came up with the question: I wonder what networks most commonly house AMPR gateways?

So, in this short post, I shall set out to answer that question.

A brief overview

Feel free to read about AMPRNet yourself online. There's lots of great information floating around.

For anyone looking for a TLDR before continuing, you can basically think of AMPRNet as an ad-hoc mesh of gateways that act as core routers for tiny slices of IP space. These gateways share routing information with each other and form a mixed-topology network that spans the globe.

What gateways exist?

Firstly, in order to figure out what networks house gateways, I need to know what gateways exist.

AMPR operators have access to a little API that allows us to query for a list of all active gateways, so thats where I shall start.

If you happen to be following along at home, heres the commands I am using to get my list of gateway IPs:

AMPR_API_TOKEN="your-api-token-here"
http get https://portal.ampr.org/api/v1/encap/routes \
  "Authorization: Bearer $AMPR_API_TOKEN" \
  "Accept: application/json" \
  | jq ".encap[].gatewayIP" \
  | tr -d '"' \
  | sort \
  | uniq

This returns a nicely sorted list of approximately 650 unique gateways.

Where are they?

Now that I have a list of IPs, I just put them into a file (/tmp/ips in my case) and asked the BGP.tools API for info about them.

echo "begin\n$(cat /tmp/ips)\nend" | nc bgp.tools 43 | tee /tmp/bgp-tools-result

This gives me a very long list of ASNs for each gateway, which I can then process.

Taking the /tmp/bgp-tools-result file that the previous command generated, I can now run the following command to get a list of unique ASNs:

cat /tmp/bgp-tools-result \
  | cut -d "|" -f 7 \
  | sort \
  | uniq -c \
  | sort -n -r

The results

At the time of writing, here's the distribution of gateways by Autonomous System:

CountAutonomous System
46Comcast Cable Communications, LLC
25Charter Communications Inc
23The Constant Company, LLC
23AT&T Services, Inc.
22Verizon Business
16Charter Communications
15Akamai (Linode)
14Free SAS
11Amazon.com, Inc.
10Lumen (ex. Qwest)
10Cox Communications Inc.
10Bell Canada
9Ote SA (Hellenic Telecommunications Organisation)
9DigitalOcean LLC
249Various Others

Note: the Various Others row represents nearly 230 ASes that only host 1 gateway, and a smaller handful that host a few more.