steampipe plugin install ipinfo

Table: ipinfo_asn - Query IPinfo ASN using SQL

Autonomous System Numbers (ASNs) are a crucial part of the internet's routing infrastructure. They are used by internet service providers and large organizations to manage their network routes and traffic. With ASNs, users can understand how internet traffic is routed and identify the networks responsible for specific internet activities.

Table Usage Guide

The ipinfo_asn table provides detailed insights into Autonomous System Numbers (ASNs) within IPinfo. As a network engineer or IT professional, explore ASN-specific details through this table, including the network prefix, name, country, and associated metadata. Utilize it to uncover information about network routing, such as the routes used by an internet service provider or a large organization, and the traffic patterns of these networks.

Important Notes

  • This table requires a paid plan.
  • Because ASNs cannot be listed in full, the ipinfo_asn table requires the asn field to be specified in all queries, defining the ASN to lookup.

Examples

Info about an ASN

Gain insights into the specifics of a particular Autonomous System Number (ASN) including its name, country of origin, and the number of IP addresses it has. This is useful for network administrators and cybersecurity professionals to understand the scale and geographical location of a specific ASN.

select
name,
country_name,
num_ips
from
ipinfo_asn
where
asn = 'AS7922';
select
name,
country_name,
num_ips
from
ipinfo_asn
where
asn = 'AS7922';

IPv4 prefixes managed by an ASN

Explore which IPv4 prefixes are managed by a specific Autonomous System Number (ASN). This can be useful to understand the scope of networks managed by an ASN and potentially identify patterns or anomalies.

select
p ->> 'netblock' as netblock,
p ->> 'name' as name
from
ipinfo_asn,
jsonb_array_elements(prefixes) as p
where
asn = 'AS7922';
select
json_extract(p.value, '$.netblock') as netblock,
json_extract(p.value, '$.name') as name
from
ipinfo_asn,
json_each(prefixes) as p
where
asn = 'AS7922';

Schema for ipinfo_asn

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
allocatedtextDate when the ASN was allocated, e.g. 1997-02-14
asntext=Autonomous System Number (ASN) of the administrator for the IP, e.g. AS13335
countrytextCountry code of the ASN, e.g. US
country_nametextCountry name of the ASN, e.g. United States
domaintextDomain of the ASN, e.g. comcast.com
downstreamsjsonbDownstream information for the ASN.
nametextName of the ASN.
num_ipsbigintNumber of IPs in the ASN, e.g. 71224576
peersjsonbPeers for the ASN.
prefixesjsonbList of objects representing IPv4 ranges for the ASN.
prefixes6jsonbList of objects representing IPv6 ranges for the ASN.
registrytextRegistry for the ASN, e.g. arin
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
typetextType of the ASN, e.g. isp
upstreamsjsonbUpstream information for the ASN.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- ipinfo

You can pass the configuration to the command with the --config argument:

steampipe_export_ipinfo --config '<your_config>' ipinfo_asn