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 just get_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:

  1. a Cymru-style DNS zone, or
  2. 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:

  1. a reference to a list of AS numbers πŸ”’
  2. a Net::IP::XS object of the covering prefix for that AS 🧚
  3. a string of the raw query πŸ“
  4. 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