Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: MAC Address and NIC Device on Network.

by jepri (Parson)
on Jun 27, 2001 at 09:50 UTC ( #91837=note: print w/ replies, xml ) Need Help??


in reply to Re: MAC Address and NIC Device on Network.
in thread MAC Address and NIC Device on Network.

All boxen that implement the TCP/IP protocol must respond. Even windows machines manage it.

You can catch the return packets with Net::Packet (Update: It's NetPacket, not Net::Packet, available from CPAN, runs under windows with the pcap library), if you have root access. I have a little proggie that does this if you are interested. Actually it sits there and silently matches ethernet addresses to IPs, and identifies gateways and routers from that data.

For extra humour during a boring afternoon, ping flood the broadcast address and watch the network admin go into spasms.

____________________
Jeremy
I didn't believe in evil until I dated it.


Comment on Re: Re: MAC Address and NIC Device on Network.
(tye)Re: MAC Address and NIC Device on Network.
by tye (Cardinal) on Jun 27, 2001 at 10:06 UTC

    Or just parse `arp -a`.

    Update: The original question seems clearly to be about Windows, which does come with "arp" (I think Win2K was mentioned in the chatterbox). Your mention of "root access" makes me wonder whether Net::Packet will work on Win2K, but I don't find it on CPAN so I didn't go any further trying to check that out.

    I didn't say the method that I mentioned was the only way, of course.

    Update2: Thanks for the clarifications, jepri. I can still roll code to parse `arp -a` faster than I can download NetPacket and pcap much less install them and get them working (heck, nearly faster than I can find NetPacket given how slow http://search.cpan.org/ is these days). So if all I'm interested in the MAC addresses, I'll stick with arp output unless I've already gotten NetPacket working for other reasons.

    But I didn't reply to criticize your suggestion. I just waited a while and noted that no one else had mentioned "arp -a" yet so I thought it should be part of the thread. So I decided to post it in reply a node that mentioned something acurate and your fact about all TCP/IP stacks having to support ARP won. (:

            - tye (but my friends call me "Tye")
      Works if you have arp. Why go outside Perl when there's a nice module that does what you want? The interface is nicer too.

      Finally arp will only return the IP number of the interface, whereas you can get so much more information with a little bit of sniffing.

      ____________________
      Jeremy
      I didn't believe in evil until I dated it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-07-24 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (156 votes), past polls