1ARP(3) User Contributed Perl Documentation ARP(3)
2
3
4
6 ARP - Perl extension for creating ARP packets
7
9 use Net::ARP;
10 Net::ARP::send_packet('lo', # Device
11 '127.0.0.1', # Source IP
12 '127.0.0.1', # Destination IP
13 'aa:bb:cc:aa:bb:cc', # Source MAC
14 'aa:bb:cc:aa:bb:cc', # Destinaton MAC
15 'reply'); # ARP operation
16
17 $mac = Net::ARP::get_mac("enp3s0f1");
18
19 print "$mac\n";
20
21 $mac = Net::ARP::arp_lookup($dev,"192.168.1.1");
22
23 print "192.168.1.1 has got mac $mac\n";
24
25 IMPORTANT
26 Version 1.0 will break with the API of PRE-1.0 versions, because the
27 return value of arp_lookup() and get_mac() will no longer be passed as
28 parameter, but returned! I hope this decision is ok as long as we get
29 a cleaner and more perlish API.
30
31 DESCRIPTION
32 This module can be used to create and send ARP packets and to get the
33 mac address of an ethernet interface or ip address.
34
35 send_packet()
36 Net::ARP::send_packet('lo', # Device
37 '127.0.0.1', # Source IP
38 '127.0.0.1', # Destination IP
39 'aa:bb:cc:aa:bb:cc', # Source MAC
40 'aa:bb:cc:aa:bb:cc', # Destinaton MAC
41 'reply'); # ARP operation
42
43 I think this is self documentating.
44 ARP operation can be one of the following values:
45 request, reply, revrequest, revreply, invrequest, invreply.
46
47 get_mac()
48 $mac = Net::ARP::get_mac("eth0");
49
50 This gets the MAC address of the eth0 interface and stores
51 it in the variable $mac. The return value is "unknown" if
52 the mac cannot be looked up.
53
54 arp_lookup()
55 $mac = Net::ARP::arp_lookup($dev,"192.168.1.1");
56
57 This looks up the MAC address for the ip address 192.168.1.1
58 and stores it in the variable $mac. The return value is
59 "unknown" if the mac cannot be looked up.
60
62 man -a arp
63
65 Bastian Ballmann [ balle@codekid.net ]
66 http://www.codekid.net
67
69 Copyright (C) 2004-2020 by Bastian Ballmann
70
71 License: GPLv2
72
73
74
75perl v5.32.1 2021-01-27 ARP(3)