1ARP(3)                User Contributed Perl Documentation               ARP(3)
2
3
4

NAME

6       ARP - Perl extension for creating ARP packets
7

SYNOPSIS

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("eth0");
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             The default ARP operation is reply.
47
48       get_mac()
49             $mac = Net::ARP::get_mac("eth0");
50
51             This gets the MAC address of the eth0 interface and stores
52             it in the variable $mac. The return value is "unknown" if
53             the mac cannot be looked up.
54
55       arp_lookup()
56             $mac = Net::ARP::arp_lookup($dev,"192.168.1.1");
57
58             This looks up the MAC address for the ip address 192.168.1.1
59             and stores it in the variable $mac. The return value is
60             "unknown" if the mac cannot be looked up.
61

SEE ALSO

63        man -a arp
64

AUTHOR

66        Bastian Ballmann [ Balle@chaostal.de ]
67        http://www.datenterrorist.de
68
70       Copyright (C) 2004-2007 by Bastian Ballmann
71
72       This library is free software; you can redistribute it and/or modify it
73       under the same terms as Perl itself, either Perl version 5.8.1 or, at
74       your option, any later version of Perl 5 you may have available.
75
76
77
78perl v5.12.0                      2009-04-24                            ARP(3)
Impressum