# 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 .origin.asn.ipasn.net ``` **IPv6:** ``` dig +short TXT .origin6.asn.ipasn.net ``` **Response format:** `" | | | | "` **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 .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 .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 .dns.ipasn.net ``` **Force IPv4 (A record):** ``` dig +short TXT .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 .cc.ipasn.net ``` Response: `"US"` **RPKI/ROA Status:** ``` dig +short TXT .rpki.ipasn.net ``` Response: `"VLD_216.88.0.0/14-24_3561_ARIN"` --- ## Query Pattern Summary | Query Type | DNS Name Pattern | |------------|-----------------| | Cymru-compat (IPv4) | `.origin.asn.ipasn.net` | | Cymru-compat (IPv6) | `.origin6.asn.ipasn.net` | | Full detail | `.ipasn.net` | | JSON output | `.json.ipasn.net` | | DNS resolve (default) | `.dns.ipasn.net` | | DNS resolve (force A) | `.a.dns.ipasn.net` | | Country code only | `.cc.ipasn.net` | | RPKI status only | `.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.