Re: MAC ADDRESS

From: Rod Smith (rodsmith_at_nessus.rodsbooks.com)
Date: 06/14/04


Date: Mon, 14 Jun 2004 19:19:57 -0000

In article <2j5eapFqf0ibU1@uni-berlin.de>,
        "robeto" <rrr@noce.it> writes:
>
> "James Knott" <bit_bucket@rogers.com> wrote in message
> news:fnfzc.27619$0FI1.10037@news01.bloor.is.net.cable.rogers.com...
>> robeto wrote:
>>
>> > How can I retrieve the MAC address of a machine from the ip in a different
>> > subnet from mine?
>>
>> You need something on that other subnet to read the mac and relay it to you.
>> The mac address doesn't pass through the router.
>
> Yes. I know...
> But I want to know another solution. I don't want to relay to another
> server.
> In winzoz you can use nbtstat. is it possible that there isn't a linux
> equivalent?

I just tried with NBTSTAT in Windows XP and got clearly erroneous MAC
addresses (00-00-00-00-00-00 for all the machines I tried). Perhaps it's
working correctly for you, but not for me.

In any event, the rough Linux equivalent of NBTSTAT is nmblookup, but I
can't seem to get it to report MAC addresses. AFAIK and as others have
said, there's no way to get the MAC address directly from another subnet;
you'll need to enlist the help of a computer on that subnet. Presumably
NBTSTAT is using the remote network's domain controller, master browser,
or some other SMB/CIFS system to get the information. (If it's really
getting it at all; on my network it's clearly either not getting or not
reporting accurate information.) If a tool to get this information in the
same way exists in Linux, chances are it'd be in the Samba suite. The
other alternative would be to use some other protocol to extract the
information with the help of another system without using SMB/CIFS --
say, using ssh to run arp on a remote system, as in "ssh
remotesystem.example.com arp 192.168.1.7" to find the MAC address of
192.168.1.7, using remotesystem.example.com as an intermediary.

-- 
Rod Smith, rodsmith@rodsbooks.com
http://www.rodsbooks.com
Author of books on Linux, FreeBSD, and networking