Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > get ip from mac

Reply
Thread Tools

get ip from mac

 
 
BigZero
Guest
Posts: n/a
 
      07-14-2008
hello ppl,
is there any way or posable to get a ip-Address from mac address, i
mean that i have the mac address of a machine and i want to known the
ip address of that mac id or machine.....




Thanks
VM
 
Reply With Quote
 
 
 
 
Thomas Schodt
Guest
Posts: n/a
 
      07-14-2008
BigZero wrote:
> hello ppl,
> is there any way or posable to get a ip-Address from mac address, i
> mean that i have the mac address of a machine and i want to known the
> ip address of that mac id or machine.....


arp -a
 
Reply With Quote
 
 
 
 
Nigel Wade
Guest
Posts: n/a
 
      07-14-2008
BigZero wrote:

> hello ppl,
> is there any way or posable to get a ip-Address from mac address, i
> mean that i have the mac address of a machine and i want to known the
> ip address of that mac id or machine.....
>
>


Directly from Java? None that I know of.

What you want is ARP (address resolution protocol) which maps between IP and
Ethernet MAC. A typical scenario is first to ping the machine (it doesn't
matter whether the ping succeeds), or attempt to open a socket, to ensure that
the ARP cache has an entry for the machine in question. Then you query the ARP
cache by some means.

--
Nigel Wade
 
Reply With Quote
 
BigZero
Guest
Posts: n/a
 
      07-14-2008
On Jul 14, 5:41 pm, Nigel Wade <n...@ion.le.ac.uk> wrote:
> BigZero wrote:
> > hello ppl,
> > is there any way or posable to get a ip-Address from mac address, i
> > mean that i have the mac address of a machine and i want to known the
> > ip address of that mac id or machine.....

>
> Directly from Java? None that I know of.
>
> What you want is ARP (address resolution protocol) which maps between IP and
> Ethernet MAC. A typical scenario is first to ping the machine (it doesn't
> matter whether the ping succeeds), or attempt to open a socket, to ensure that
> the ARP cache has an entry for the machine in question. Then you query the ARP
> cache by some means.
>
> --
> Nigel Wade


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
to known is that is it possible to ip from mac address or can i query
the snmp with mac address.....


Thanks
VM
 
Reply With Quote
 
Nigel Wade
Guest
Posts: n/a
 
      07-14-2008
BigZero wrote:

> On Jul 14, 5:41 pm, Nigel Wade <n...@ion.le.ac.uk> wrote:
>> BigZero wrote:
>> > hello ppl,
>> > is there any way or posable to get a ip-Address from mac address, i
>> > mean that i have the mac address of a machine and i want to known the
>> > ip address of that mac id or machine.....

>>
>> Directly from Java? None that I know of.
>>
>> What you want is ARP (address resolution protocol) which maps between IP and
>> Ethernet MAC. A typical scenario is first to ping the machine (it doesn't
>> matter whether the ping succeeds), or attempt to open a socket, to ensure

that
>> the ARP cache has an entry for the machine in question. Then you query the

ARP
>> cache by some means.
>>
>> --
>> Nigel Wade

>
> 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
> to known is that is it possible to ip from mac address or can i query
> the snmp with mac address.....
>
>


Sorry, can't help with SNMP. I've never used it.

We are prohibited by local edict from using SNMP. SNMP is restricted to the
central IT dept. who use it to manage their own equipment.

--
Nigel Wade
 
Reply With Quote
 
BigZero
Guest
Posts: n/a
 
      07-14-2008
On Jul 14, 6:53 pm, Nigel Wade <n...@ion.le.ac.uk> wrote:
> BigZero wrote:
> > On Jul 14, 5:41 pm, Nigel Wade <n...@ion.le.ac.uk> wrote:
> >> BigZero wrote:
> >> > hello ppl,
> >> > is there any way or posable to get a ip-Address from mac address, i
> >> > mean that i have the mac address of a machine and i want to known the
> >> > ip address of that mac id or machine.....

>
> >> Directly from Java? None that I know of.

>
> >> What you want is ARP (address resolution protocol) which maps between IP and
> >> Ethernet MAC. A typical scenario is first to ping the machine (it doesn't
> >> matter whether the ping succeeds), or attempt to open a socket, to ensure

> that
> >> the ARP cache has an entry for the machine in question. Then you query the

> ARP
> >> cache by some means.

>
> >> --
> >> Nigel Wade

>
> > 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
> > to known is that is it possible to ip from mac address or can i query
> > the snmp with mac address.....

>
> Sorry, can't help with SNMP. I've never used it.
>
> We are prohibited by local edict from using SNMP. SNMP is restricted to the
> central IT dept. who use it to manage their own equipment.
>
> --
> Nigel Wade


hey no problem thanks, i hope somebody may worked on that thing, all i
get stuck in get all ip from a single packet request that is
"broadcasting",
i m enable do this in snmp or non-snmp(simple java) program,
 
Reply With Quote
 
Mark Rafn
Guest
Posts: n/a
 
      07-14-2008
BigZero <> wrote:
>is there any way or posable to get a ip-Address from mac address, i
>mean that i have the mac address of a machine and i want to known the
>ip address of that mac id or machine.....


This requires more context. A given mac address can have multiple IP
addresses, and the only mappings between them are local to the networking
stack on that host, and in the arp tables of hosts on the same ethernet
segment. Outside the local network segment, there is no knowledge of mac
addresses: they are not part of IP, they're part of ethernet.

As others have said, you might look into smtp for connecting to that host and
querying information about it. Or if you're on the same segment, look at your
own arp tables (see the arp command if you're on a unix-like machine).

Otherwise, look for a different way to solve whatever your real problem is.
--
Mark Rafn <http://www.dagon.net/>

 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      07-14-2008
On Mon, 14 Jul 2008, Nigel Wade wrote:

> BigZero wrote:
>
>> is there any way or posable to get a ip-Address from mac address, i
>> mean that i have the mac address of a machine and i want to known the
>> ip address of that mac id or machine.....

>
> Directly from Java? None that I know of.
>
> What you want is ARP (address resolution protocol) which maps between IP
> and Ethernet MAC. A typical scenario is first to ping the machine (it
> doesn't matter whether the ping succeeds), or attempt to open a socket,
> to ensure that the ARP cache has an entry for the machine in question.


Ah, but if you know the MAC address but not the IP, you can't do that.

I think you'd need to do something like craft an IP packet which had the
broadcast address as a destination, then send it to the right MAC address
using a raw socket. Actually, not even a raw socket, a SOCK_PACKET or
something. Yikes. Anyway, it should be something that elicits a response
that will put the mapping into the ARP cache. A normal ARP request might
do it, unless your host ignores apparently-unsolicited ARP responses. I'm
trying to work out if there's a way to provoke the target into emitting an
ARP announcement, but i can't think of anything.

You might just have to cross your fingers and hope the target is already
in your ARP cache!

> Then you query the ARP cache by some means.


Yes. I can't find anything better than arp -a, as Thomas Schodt suggested.
There doesn't seem to be a portable API to arp; linux has some ioctls, and
/proc/net/arp, but that's it.

The OP should probably try a networking group with this question.

tom

--
Let us learn to dream, gentlemen, and then perhaps we will learn the
truth. -- Friedrich Kekule
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      07-15-2008
BigZero wrote:
> On Jul 14, 6:53 pm, Nigel Wade <n...@ion.le.ac.uk> wrote:
>> BigZero wrote:
>>> On Jul 14, 5:41 pm, Nigel Wade <n...@ion.le.ac.uk> wrote:
>>>> BigZero wrote:
>>>>> hello ppl,
>>>>> is there any way or posable to get a ip-Address from mac address, i
>>>>> mean that i have the mac address of a machine and i want to known the
>>>>> ip address of that mac id or machine.....
>>>> Directly from Java? None that I know of.
>>>> What you want is ARP (address resolution protocol) which maps between IP and
>>>> Ethernet MAC. A typical scenario is first to ping the machine (it doesn't
>>>> matter whether the ping succeeds), or attempt to open a socket, to ensure that
>>>> the ARP cache has an entry for the machine in question. Then you query the ARP
>>>> cache by some means.
>>> 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
>>> to known is that is it possible to ip from mac address or can i query
>>> the snmp with mac address.....

>> Sorry, can't help with SNMP. I've never used it.
>>
>> We are prohibited by local edict from using SNMP. SNMP is restricted to the
>> central IT dept. who use it to manage their own equipment.

>
> hey no problem thanks, i hope somebody may worked on that thing, all i
> get stuck in get all ip from a single packet request that is
> "broadcasting",
> i m enable do this in snmp or non-snmp(simple java) program,


If you want to give SNMP a try, then:

http://www.snmp4j.org/

may save you some of the low level work.

Arne
 
Reply With Quote
 
Nigel Wade
Guest
Posts: n/a
 
      07-15-2008
Tom Anderson wrote:

> On Mon, 14 Jul 2008, Nigel Wade wrote:
>
>> BigZero wrote:
>>
>>> is there any way or posable to get a ip-Address from mac address, i
>>> mean that i have the mac address of a machine and i want to known the
>>> ip address of that mac id or machine.....

>>
>> Directly from Java? None that I know of.
>>
>> What you want is ARP (address resolution protocol) which maps between IP
>> and Ethernet MAC. A typical scenario is first to ping the machine (it
>> doesn't matter whether the ping succeeds), or attempt to open a socket,
>> to ensure that the ARP cache has an entry for the machine in question.

>
> Ah, but if you know the MAC address but not the IP, you can't do that.
>


Quite, one of those "Duh!" moments...

--
Nigel Wade
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get ubuntu ! Get ubuntu ! Get ubuntu ! Get ubuntu ! Getubuntu Windows 64bit 1 06-01-2009 08:54 AM
Image quality on .mac (dot mac) eyalnevo@gmail.com Digital Photography 4 05-16-2006 03:07 PM
Vertical Gap between DIVs in Opera 8.5 Mac + IE 5.2 Mac mangm HTML 2 12-01-2005 12:48 PM
mac!! mac!!! * * * Y o u r . S h e p h e r d . A q u i l a . D e u s . ( d 2 0 0 5 x x , d 2 0 0 4 x x , d 2 0 0 Computer Support 7 06-03-2005 12:48 AM
Senseless rendering: Mac.Mozilla != Mac.Netscape6.01 ?!?! Roman =?ISO-8859-15?Q?Bl=F6th?= HTML 1 07-02-2003 10:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57