-1

I want to look up a MAC adrress by an IP.

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

But on the CPAN page, they don't explain what is this $dev variable for?

Chris Seymour
  • 83,387
  • 30
  • 160
  • 202
eouti
  • 5,338
  • 3
  • 34
  • 42

1 Answers1

2

$dev is the network interface to use to try to connect to the given IP address. In the other methods, 'lo' and 'eth0' are given as examples.

ysth
  • 96,171
  • 6
  • 121
  • 214
  • Ok, i changed $dev to "eth0" (this is my interface) but when running i got the error : `SIOCGARP: No device or address` – eouti May 18 '11 at 08:42
  • @eouti : Does running the script via sudo help? – hlynur May 18 '11 at 18:00
  • FWIW, I was able to successfully get my router's mac address, but not that of any other device connected to the router, even though I can connect to them. – ysth May 18 '11 at 18:10