From: Tom Anderson on
On Tue, 22 Jul 2008, Roedy Green wrote:

> On Tue, 22 Jul 2008 17:44:56 +0100, Tom Anderson
> <twic(a)urchin.earth.li> wrote, quoted or indirectly quoted someone who
> said :
>
>> I think the OP was asking about doing MAC -> IP for a *remote* machine.
>
> IIRC the MACs of remote machines are considered secret.

Given that they're written on every network packet the machines send out,
and knowledge of them is required in order to send packets back to those
machines, that seems a pretty radical kind of secrecy.

Certainly, MAC (or other link-layer) addresses are thoroughly encapsulated
by the network stack on the local machine, so user-level programs don't
need to worry about them, but i wouldn't call that keeping them secret.
You can find out about them using the arp -a command on unix; i assume
there's something similar on windows.

> He then knows the MAC through some mysterious means.

Yes, perhaps he's mastered the dark secrets of the 'ifconfig' command.

> I would not hold out hope of any ability to manipulate MAC to IP without
> running some code on the remote machine.

Well, if by 'manipulate' you mean changing the mapping, then no - either
on the remote machine, or on the DHCP machine which gives it its IP
address. But if you mean find out what the mapping is, then that's
eminently possible.

tom

--
Sometimes it takes a madman like Iggy Pop before you can SEE the logic
really working.
From: Tom Anderson on
On Tue, 22 Jul 2008, Mark Space wrote:

> BigZero wrote:
>
>> well i m getting mac address from SNMP, i known that i can get ip
>> address if i query the ip OID. but the ip address changes(DHCP) so we
>> want to keep the history of a machine so i m using mac address that
>> never changes, so here all want
>
> In this sort of scenario, it's usual to give the machine a name that
> doesn't change (for example, machine1.example.com) and then use that to
> look up the machine. That way if IP address changes, the name doesn't.
>
> If you have some IT genius who's invented some sort of random, changing
> name policy, they you're hosed.

Where i work, machines are allocated IP numbers and addresses by DHCP,
with the hostnames being constructed from the address. Right now, my work
machine is 128.40.81.98 and mrclmcb98.mcbl.ucl.ac.uk. Tomorrow, both could
be different. I believe many networks are run this way.

It would be vastly better if the hostnames were constant. This could be
done by having a static mapping at the DHCP server, but that would be a
bit of a pain to administer. It could also be done by transmitting a
desired machine name as a client-identifer option in the DHCP request
(which is supported by MacOS, and i would guess also by windows):

http://tools.ietf.org/html/rfc2132#section-9.14

And having the DHCP server use that to form the address.

The fact that all this doesn't work is the reason why Apple came up with
zeroconf:

http://www.zeroconf.org/

Which does this, amongst other things - participating machines run a
micro-DNS server, through which they expose their own locally-chosen
hostname, plus other things like shared volumes, printers, etc.

> I don't see an nslookup for Java, but Google yields some hits when
> searching, so you might find some free Java code that does what you
> need.

Here's one:

http://www.dnsjava.org/index.html

tom

--
Sometimes it takes a madman like Iggy Pop before you can SEE the logic
really working.
From: Roedy Green on
On Wed, 23 Jul 2008 00:28:01 +0100, Tom Anderson
<twic(a)urchin.earth.li> wrote, quoted or indirectly quoted someone who
said :

>> He then knows the MAC through some mysterious means.
>
>Yes, perhaps he's mastered the dark secrets of the 'ifconfig' command.

That is how you find out your OWN MAC. The way he found out the remote
MAC required some unspecified fiddle to get the machine to reveal it
to the outside world, perhaps via a human on the telephone.

The MAC is confidential in the sense the Java Applet sandbox will IIRC
not let you find out the MAC of your own machine and tattle to another
machine, unless you sign the applet.

It is not a secret in the sense of a certificate private key.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
From: Tom Anderson on
On Wed, 23 Jul 2008, Roedy Green wrote:

> On Wed, 23 Jul 2008 00:28:01 +0100, Tom Anderson
> <twic(a)urchin.earth.li> wrote, quoted or indirectly quoted someone who
> said :
>
>>> He then knows the MAC through some mysterious means.
>>
>> Yes, perhaps he's mastered the dark secrets of the 'ifconfig' command.
>
> That is how you find out your OWN MAC. The way he found out the remote
> MAC required some unspecified fiddle to get the machine to reveal it to
> the outside world, perhaps via a human on the telephone.

Yes, that's what i was thinking. It could be a bit more automatic than a
technician with a phone, but that would also work. If he's only monitoring
a small number of machines, it might even be the easiest way to do it.

> The MAC is confidential in the sense the Java Applet sandbox will IIRC
> not let you find out the MAC of your own machine and tattle to another
> machine, unless you sign the applet.

That's certainly true.

But it is possible to do it without running *any code at all* on the
remote machine - you can get the remote machine's MAC address from your
own local ARP cache.

Here's a script to do it under unix:

#! /bin/bash
addr=$1
arp -a | grep $addr | cut -d " " -f 4

I've called it getmac - here it is in action:

cramerlab$ getmac mrclmcb174.mcbl.ucl.ac.uk
0:d:93:40:b1:e6

You do need to have the remote machine in your ARP cache, which means
either pinging it somehow, or waiting for it to advertise itself.

tom

--
We can only see a short distance ahead, but we can see plenty there that
needs to be done. -- Alan Turing
From: BigZero on
On Jul 23, 6:05 pm, Tom Anderson <t...(a)urchin.earth.li> wrote:
> On Wed, 23 Jul 2008, Roedy Green wrote:
> > On Wed, 23 Jul 2008 00:28:01 +0100, Tom Anderson
> > <t...(a)urchin.earth.li> wrote, quoted or indirectly quoted someone who
> > said :
>
> >>> He then knows the MAC through some mysterious means.
>
> >> Yes, perhaps he's mastered the dark secrets of the 'ifconfig' command.
>
> > That is how you find out your OWN MAC. The way he found out the remote
> > MAC required some unspecified fiddle to get the machine to reveal it to
> > the outside world, perhaps via a human on the telephone.
>
> Yes, that's what i was thinking. It could be a bit more automatic than a
> technician with a phone, but that would also work. If he's only monitoring
> a small number of machines, it might even be the easiest way to do it.
>
> > The MAC is confidential in the sense the Java Applet sandbox will IIRC
> > not let you find out the MAC of your own machine and tattle to another
> > machine, unless you sign the applet.
>
> That's certainly true.
>
> But it is possible to do it without running *any code at all* on the
> remote machine - you can get the remote machine's MAC address from your
> own local ARP cache.
>
> Here's a script to do it under unix:
>
> #! /bin/bash
> addr=$1
> arp -a | grep $addr | cut -d " " -f 4
>
> I've called it getmac - here it is in action:
>
> cramerlab$ getmac mrclmcb174.mcbl.ucl.ac.uk
> 0:d:93:40:b1:e6
>
> You do need to have the remote machine in your ARP cache, which means
> either pinging it somehow, or waiting for it to advertise itself.
>
> tom
>
> --
> We can only see a short distance ahead, but we can see plenty there that
> needs to be done. -- Alan Turing

Well this script not worked for me
it gives error arp: command not found
i try this on the Linux 2.6.11-1.1369_FC4 i686 athlon i386 GNU/Linux


Thanks
VM