Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Easy search on MAC address

by giomar (Initiate)
on Jun 05, 2010 at 03:56 UTC ( [id://843238]=perlquestion: print w/replies, xml ) Need Help??

giomar has asked for the wisdom of the Perl Monks concerning the following question:

Hi: I tried to scan a file full of MAC addresses match to hostnames, but I cannot get the IP on the network. I thought becuase of TimeZone,thereof I included diference of TimeValue of a table(file). ARP unfortunately only works locally; it doesn't model display its respective IP. Not sure if library Net::Arp is any good once the scan reaches a host. Any thoughts!

Replies are listed 'Best First'.
Re: Easy search on MAC address
by Marza (Vicar) on Jun 05, 2010 at 05:27 UTC

    Arp is not going to cut it if you are crossing time zones which means you are going across the WAN. Keep in mind one of the routers main job is to kill broadcasts which is what arp does.

    What you could do is review the routers arp tables with net::snmp.

Re: Easy search on MAC address
by bluescreen (Friar) on Jun 05, 2010 at 18:08 UTC

    Address Resolution Protocol (ARP) does exactly the opposite, I mean it transforms IP Addresses into their corresponding MAC Addresses, it uses the physical to send the packet and bring the attention of the remote NIC (Network Interface Card), it caches that information in the ARP table to avoid doing the query for each packet. ARP table's info is not persistent because as you can imagine IP addresses can change (i.e:DHCP)

    What I'm trying to say is that there is no direct way to translate MAC into IP, unless you ping your entire network so you build the ARP table ( this is crazy and takes forever ) or use another mechanism like querying a router/switch for their entries ( they are short-lived too). Even more the entries in the ARP table are from your LAN, all other IP addresses behind the router will have router's MAC address

      Note also that if you collect MAC addresses from different network segments, you may find MAC addresses aren't unique (some OSses use the same MAC address for all their interfaces by default), or that different MAC addresses map to the same IP address.

      There's a reason that 1) ARP caches expire quickly, and 2) MAC addresses are used on a level below routable IP.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://843238]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found