Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: How can I find a MAC address from aremote IP ?

by arhuman (Vicar)
on Mar 30, 2001 at 19:06 UTC ( #68386=note: print w/replies, xml ) Need Help??

in reply to How can I find a MAC address from aremote IP ?

NetPacket::ARP should be able to do the job...
or using `arp -a` and a regex (dirty but works on unix and windows...)

(It may be useful to ping the host before using arp
to refresh the arp table in the case the entry is not present)

"Only Bad Coders Badly Code In Perl" (OBC2IP)
  • Comment on Re: How can I find a MAC address from aremote IP ?

Replies are listed 'Best First'.
Re: Re: How can I find a MAC address from aremote IP ?
by Malkavian (Friar) on Mar 30, 2001 at 20:05 UTC
    Hmm.. You sure arp works on a distant remote IP?
    From memory, it's only local subnet.
    Plus, I don't think you get a valid MAC address from a PPP link either.

      Nothing is going to tell you the MAC address of something that is not within your local broadcast domain! You'd have to get some code to run in the local broadcast domain of the remote IP address and have it forward you the information.

      And PPP links don't have MAC addresses. A MAC address is an Ethernet thing and you don't run PPP over Ethernet.

      So I would assume that the original question was asking for a MAC address of an Ethernet (and non-PPP) adapter that was not local to the computer but that was in the local broadcast domain -- nothing else makes much sense. So ARP is the most logical answer.

              - tye (but my friends call me "Tye")
        Actually.. MAC addresses are not an Ethernet thing. Token Ring uses them too... The reason Remote networks are usually harder to get MAC address for could be because of Hardware Address Translation. It all depends on how the routers are set up.
      Oops ! You're right arp will only work with local IP addresses...
      (I always forget to mention...)

      "Only Bad Coders Badly Code In Perl" (OBC2IP)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://68386]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2016-10-28 01:26 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (373 votes). Check out past polls.