in reply to How to get Mac Address from IP

Well, you could always use
my ($mac) = `arp -a $ip_address` =~ /at\s+(\S+)\s+/;
although you may have to adjust the regex to match the wording of your particular arp.

Abigail

Replies are listed 'Best First'.
Re: Re: How to get Mac Address from IP
by NetWallah (Canon) on Jan 13, 2004 at 18:02 UTC
    You need to be careful about WHOM you request the ARP info from.

    If the workstation is on a different subnet than the querier, an ARP will cause your router to respond with a "Proxy ARP", and you will end up with the mac address of the router - this is usaually a GOOD thing, since the router will help you send traffic to it's destination, but is that what you really want? The original poster's intent was not clear.

    In the Windows world, you can get a remote machine's MAC address running

    NBTSTAT -A <IP-addr>
    on your workstation.

    "When you are faced with a dilemma, might as well make dilemmanade. "