The sys admin's daily grind: ASN

Charly's Column – ASN

Article from Issue 254/2022

When digging into BGP routing information, Charly avoids the highway through parameter hell thanks to the ASN tool. In addition to a system's AS number, ASN delivers other information, such as its peering partners upstream and downstream.

Every admin knows how to deal with IP addresses. Unfortunately, IPs never turn up alone. They belong to a network, and the network is almost always assigned to an autonomous system (AS), which uses the Border Gateway Protocol (BGP) to exchange routing information.

There is a simple way to find out which AS a particular individual IP belongs to. By way of an example, the following is the IP address of Computec Media's web server, The associated IP address can be discovered using dig or by simply pinging.

I then feed this IP address to a tool named ASN [1]. The shell script aggregates the output of several other tools and presents the results in a clear-cut way. It has a number of dependencies that vary depending on the distribution you are using. What exactly needs to be installed for ASN to work is explained in a separate section on the tool's GitHub page.

The output from calling asn reveals that the IP address in question belongs to network and AS15598 (Figure 1). AS numbers (ASN) are unique worldwide and are assigned by the Internet Assigned Numbers Authority (IANA).

Figure 1: A first call reveals the ASN, among other things.

A second call with the ASN as a parameter (asn AS15598) provides a variety of information about the AS, such as the upstream and downstream peering partners (Figure 2). In addition, you can see which other networks are assigned to this AS besides the already known and which paths the data packets take from the local AS to the destination (Figure 3).

Figure 2: Calling the tool with the ASN reveals a plethora of information, including …
Figure 3: … the routes the packets take from the home AS to the target.

All this information could be obtained in other ways, but thanks to ASN, I was able to save time and avoid a detour through parameter hell.

The Author

Charly Kühnast manages Unix systems in a data center in the Lower Rhine region of Germany. His responsibilities include ensuring the security and availability of firewalls and the DMZ.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Charly's Column – Gatling

    Western aficionados and sys admin Charly are about to set up a Gatling in a field that is normally home to Apache. Read on to discover why blogger Fefe is to blame.

  • Charly's Birds

    Charly ran a first-generation Rasp Pi for years in the birdhouse in his garden, but the Rasp Pi eventually fell foul of marauding wasps. Now Charly has replaced it with an RPi3 featuring a NoIR cam and motion detection.

  • The sys admin's daily grind: Smorgasbord

    Sys admin columnist Charly Kühnast has an electronic note box in which he collects ideas and small snippets of code. He calls it his "quarry" and is taking this opportunity to offer up some collectors' items to regular readers.

  • Charly's Column

    Parallel SSH is the name of an easy-to-configure tool that our resident sys admin, Charly, now routinely deploys whenever he needs to launch the same programs, copy the same files, or kill the same processes simultaneously on multiple computers.

  • Charly's Column – XMLStarlet

    Charly and XML have never been best friends. However, because it was vital for him to have an excellent climate indoors, he plucked up his courage and considered XMLStarlet.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More