ARP(3pm)

πŸ’– ARP β€” the Perl page from ARP(3pm) πŸ’–

okay so bestie, welcome to ARP, a Perl extension for creating ARP packets ✨ it lives in the User Contributed Perl Documentation section of the manual, page ARP(3pm), and it's genuinely one of the most fun little network toys you can hold in a Perl script πŸŽ€


✨ NAME ✨

ARP β€” a Perl extension for creating ARP packets πŸ¦‹


🌸 SYNOPSIS 🌸

  use Net::ARP;
  Net::ARP::send_packet('lo',                 # Device
                        '127.0.0.1',          # Source IP
                              '127.0.0.1',          # Destination IP
                                    'aa:bb:cc:aa:bb:cc',  # Source MAC
                              'aa:bb:cc:aa:bb:cc',  # Destinaton MAC
                              'reply');             # ARP operation

  $mac = Net::ARP::get_mac("enp3s0f1");

  print "$mac\n";

  $mac = Net::ARP::arp_lookup($dev,"192.168.1.1");

  print "192.168.1.1 has got mac $mac\n";

no cap, that's the whole vibe right there πŸ’…

🚨 IMPORTANT 🚨

Version 1.0 will break with the API of PRE-1.0 versions, because the return value of arp_lookup() and get_mac() will no longer be passed as parameter, but returned! 😭 The author hopes this decision is ok as long as we get a cleaner and more perlish API 🫢 β€” and honestly? we did πŸ™ˆ


πŸ’œ DESCRIPTION πŸ’œ

This module can be used to create and send ARP packets, and to get the mac address of an ethernet interface or ip address πŸ‘‘ it's giving "small module, big power."

send_packet() πŸ’Œ

Net::ARP::send_packet('lo',                 # Device
                      '127.0.0.1',          # Source IP
                            '127.0.0.1',          # Destination IP
                                  'aa:bb:cc:aa:bb:cc',  # Source MAC
                            'aa:bb:cc:aa:bb:cc',  # Destinaton MAC
                            'reply');             # ARP operation

I think this is self documentating. 😌✨ (that's a direct vibe-transfer from the original, bestie)

The ARP operation can be one of the following values πŸŽ€:

  • request
  • reply
  • revrequest
  • revreply
  • invrequest
  • invreply

get_mac() πŸ¦‹

$mac = Net::ARP::get_mac("enp3s0f1");

This gets the MAC address of the enp3s0f1 interface and stores it in the variable $mac πŸ’Ύ The return value is "unknown" if the mac cannot be looked up 🌸 (yes, the literal string, not a fancy error object β€” iconic behaviour, honestly)

arp_lookup() πŸ”

$mac = Net::ARP::arp_lookup($dev,"192.168.1.1");

This looks up the MAC address for the ip address 192.168.1.1 and stores it in the variable $mac πŸ’– The return value is "unknown" if the mac cannot be looked up πŸŽ€ same energy, different function, we love consistency.


🌈 SEE ALSO 🌈

  • man -a arp πŸ‘‘ β€” go read the real thing too, iykyk

🌟 AUTHOR 🌟

the icon, the legend, the main character πŸ’œ


Copyright (C) 2004-2022 by Bastian Ballmann

License: GPLv2 🌸


okay that's the whole page bestie, you ate it πŸ’…βœ¨

Sending you off with the receipts: this page came from perl v5.42.3, dated 2026-08-19 β€” so if you ever need to cite the exact vintage of this vibe, that's the number πŸŽ€ mwah, go send some ARP packets responsibly πŸ¦‹πŸ’–

πŸ“¦ where this page comes from