Zonema...NLookup(3pm)
β¨ NAME β¨
Zonemaster::Engine::ASNLookup β the little Perl module that does lookups of ASNs for IP addresses π
No cap, this is Zonema...NLookup(3pm) from the User Contributed Perl Documentation, and it's about to be your new fave. You hand it an IP, it goes and finds out which Autonomous System that IP lives in. That's the whole vibe. π¦
πΈ SYNOPSIS πΈ
okok here's how you actually call it:
my ( $asnref, $prefix, $raw, $ret_code ) = Zonemaster::Engine::ASNLookup->get_with_prefix( '8.8.4.4' );
my $asnref = Zonemaster::Engine::ASNLookup->get( '192.168.0.1' );
see like... one call gives you everything β the ASN ref, the prefix, the raw query and the return code β and the other one is the low-key version that just hands you the AS numbers. pick your fighter bestie π
π FUNCTION π
two functions, both iconic, both doing the most in the best way:
get($addr)β literally justget_with_prefix(), but glossier β¨ It returns only the list of AS numbers for the address, if any.get_with_prefix($addr)β the main character of this whole page π
So it takes a string (or a Net::IP::XS object) with a single IP address, and does a lookup in either:
- a Cymru-style DNS zone, or
- the RIPE whois server,
...which one it picks depends on the Zonemaster::Engine::Profile setting "asn_db{style}". iykyk π
And then, the way it returns stuff β it gives back a list of four things, fr fr:
- a reference to a list of AS numbers π’
- a
Net::IP::XSobject of the covering prefix for that AS π§ - a string of the raw query π
- a string of the return code for that query π·οΈ
bestie pls note: it's a single IP address per call. don't go yeeting an array of them at it, it's not that kind of party π
that's the whole page, slay π thank you for coming to my ted talk, go look up some ASNs and be obsessed.
later besties!! π from perl v5.40.1, dated 2026-03-21, and still the Zonema...NLookup(3pm) page you know and love π
π¦ where this page comes from
- ubuntu stonking: libzonemaster-perl 8.001.001-1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms