diff options
| author | hrbrmstr <bob@rud.is> | 2026-02-26 01:49:26 -0500 |
|---|---|---|
| committer | hrbrmstr <bob@rud.is> | 2026-02-26 01:49:26 -0500 |
| commit | 4ca8949a8f2eeb232da52593350e5691ca455bf2 (patch) | |
| tree | 069e5827e875d1cf48495f3965aa18778822272b /2026/2026-02-25-ipasn-net/ipasn-net-api.md | |
| parent | e95c6b116c453f9dabd78220d6a80fc08bdd72c2 (diff) | |
add: ipsan docs
Diffstat (limited to '2026/2026-02-25-ipasn-net/ipasn-net-api.md')
| -rw-r--r-- | 2026/2026-02-25-ipasn-net/ipasn-net-api.md | 204 |
1 files changed, 204 insertions, 0 deletions
diff --git a/2026/2026-02-25-ipasn-net/ipasn-net-api.md b/2026/2026-02-25-ipasn-net/ipasn-net-api.md new file mode 100644 index 0000000..1a45c6b --- /dev/null +++ b/2026/2026-02-25-ipasn-net/ipasn-net-api.md @@ -0,0 +1,204 @@ +# ipasn.net DNS API Reference + +**Source:** Geoff Huston, APNIC Blog, 2026-02-09 +**URL:** https://blog.apnic.net/2026/02/09/from-the-stupid-dns-tricks-department-ipasn-net/ + +--- + +## Overview + +`ipasn.net` is a DNS-based IP address enrichment service built on PowerDNS with a plug-in backend. Unlike Team Cymru's `origin.asn.cymru.com`, it accepts IP addresses in natural (non-reversed) order and supports IPv6 addresses with standard colon notation. All queries use DNS TXT record lookups. + +The backend assembles responses from three data sources: a current BGP routing table snapshot (origin AS and advertised prefix), a geolocation database (country code), and RIR statistics reports (registry, registration date). + +--- + +## Query Protocol + +All queries are issued via `dig +short TXT` (or equivalent DNS TXT lookups). + +--- + +## Endpoints + +### 1. Cymru-Compatible (Compact) + +Returns a pipe-delimited string similar to Team Cymru's format, but with natural IP address order. + +**IPv4:** + +``` +dig +short TXT <IPv4_ADDRESS>.origin.asn.ipasn.net +``` + +**IPv6:** + +``` +dig +short TXT <IPv6_ADDRESS>.origin6.asn.ipasn.net +``` + +**Response format:** `"<prefix> | <origin_asn> | <cc> | <rir> | <reg_date>"` + +**Example (IPv4):** + +``` +$ dig +short TXT 216.88.0.0.origin.asn.ipasn.net +"216.88.0.0/14 | 3561 | US | arin | 1998-09-25" +``` + +**Example (IPv6):** + +``` +$ dig +short TXT 2401:2000:6660::.origin6.asn.ipasn.net +"2401:2000::/32 | 4608 | AU | apnic | 2007-06-19" +``` + +--- + +### 2. Full Detail (Pipe-Delimited) + +Returns an extended pipe-delimited record with BGP, registration, org name, and RPKI/ROA data. + +``` +dig +short TXT <IP_ADDRESS>.ipasn.net +``` + +**Response format (fields separated by `|`):** + +| Position | Field | Example | +|----------|-------|---------| +| 1 | Queried Address | `216.88.0.0` | +| 2 | Address Family | `IPv4` or `IPv6` | +| 3 | BGP Status | `ADVERTISED` | +| 4 | Advertised Prefix | `216.88.0.0/14` | +| 5 | Origin AS | `3561` | +| 6 | Org Name | `CenturyLink_Communications,_LLC` | +| 7 | Country Code | `US` | +| 8 | Country Name | `United_States_of_America` | +| 9 | RIR | `arin` | +| 10 | RIR Prefix | `216.88.0.0/14` | +| 11 | Registration Status | `assigned` | +| 12 | Registration Date | `1998-09-25` | +| 13 | ROV Status | `VLD` | +| 14 | ROA Prefix | `216.88.0.0/14` | +| 15 | ROA Max Length | `24` | +| 16 | ROA Origin AS | `3561` | +| 17 | ROA Trust Anchor | `ARIN` | + +**Example:** + +``` +$ dig +short TXT 216.88.0.0.ipasn.net +"216.88.0.0|IPv4|ADVERTISED|216.88.0.0/14|3561|CenturyLink_Communications,_LLC|US|United_States_of_America|arin|216.88.0.0/14|assigned|1998-09-25|VLD|216.88.0.0/14|24|3561|ARIN" +``` + +--- + +### 3. JSON Output + +Same data as endpoint 2, returned as a JSON object. + +``` +dig +short TXT <IP_ADDRESS>.json.ipasn.net +``` + +**Response fields:** + +```json +{ + "Address": "216.88.0.0", + "Class": "IPv4", + "BGP": "ADVERTISED", + "Advertised_Prefix": "216.88.0.0/14", + "Origin_AS": "3561", + "Org_Name": "CenturyLink_Communications,_LLC", + "CC": "US", + "CC_Name": "United_States_of_America", + "RIR": "arin", + "RIR_Prefix": "216.88.0.0/14", + "Reg_Status": "assigned", + "Reg_Date": "1998-09-25", + "ROV": "VLD", + "ROA_Prefix": "216.88.0.0/14", + "ROA_Maxlen": "24", + "ROA_AS": "3561", + "ROA_TAL": "ARIN" +} +``` + +Note: The DNS TXT response may span multiple strings that need to be concatenated before JSON parsing. + +--- + +### 4. DNS Resolution + Lookup + +Resolves a domain name first, then performs the IP enrichment lookup. Returns full detail format. + +**Default (prefers AAAA/IPv6):** + +``` +dig +short TXT <FQDN>.dns.ipasn.net +``` + +**Force IPv4 (A record):** + +``` +dig +short TXT <FQDN>.a.dns.ipasn.net +``` + +**Examples:** + +``` +$ dig +short TXT www.potaroo.net.dns.ipasn.net +"2401:2000:6660:0:0:0:0:108|IPv6|ADVERTISED|2401:2000::/32|4608|..." + +$ dig +short TXT www.potaroo.net.a.dns.ipasn.net +"203.133.248.108|IPv4|ADVERTISED|203.133.248.0/24|4608|..." +``` + +--- + +### 5. Individual Attribute Queries + +Query a single field by inserting the attribute name before `ipasn.net`. + +**Country Code:** + +``` +dig +short TXT <IP_ADDRESS>.cc.ipasn.net +``` + +Response: `"US"` + +**RPKI/ROA Status:** + +``` +dig +short TXT <IP_ADDRESS>.rpki.ipasn.net +``` + +Response: `"VLD_216.88.0.0/14-24_3561_ARIN"` + +--- + +## Query Pattern Summary + +| Query Type | DNS Name Pattern | +|------------|-----------------| +| Cymru-compat (IPv4) | `<IPv4>.origin.asn.ipasn.net` | +| Cymru-compat (IPv6) | `<IPv6>.origin6.asn.ipasn.net` | +| Full detail | `<IP>.ipasn.net` | +| JSON output | `<IP>.json.ipasn.net` | +| DNS resolve (default) | `<FQDN>.dns.ipasn.net` | +| DNS resolve (force A) | `<FQDN>.a.dns.ipasn.net` | +| Country code only | `<IP>.cc.ipasn.net` | +| RPKI status only | `<IP>.rpki.ipasn.net` | + +--- + +## Notes + +- IPv4 addresses use natural dotted-quad notation (no octet reversal required). +- IPv6 addresses use standard colon-delimited notation (no nibble expansion or reversal required). +- Spaces in org names are replaced with underscores. +- ROV field values include `VLD` (valid ROA exists). Other possible values are not documented in the source material. +- The service runs on PowerDNS with a custom backend that dynamically generates responses rather than serving from a zone file.
\ No newline at end of file |
