|
From: BigZero on 14 Jul 2008 09:00 On Jul 14, 5:41 pm, Nigel Wade <n...(a)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
From: Nigel Wade on 14 Jul 2008 09:53 BigZero wrote: > On Jul 14, 5:41 pm, Nigel Wade <n...(a)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
From: BigZero on 14 Jul 2008 10:01 On Jul 14, 6:53 pm, Nigel Wade <n...(a)ion.le.ac.uk> wrote: > BigZero wrote: > > On Jul 14, 5:41 pm, Nigel Wade <n...(a)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,
From: Mark Rafn on 14 Jul 2008 13:21 BigZero <vijaymajagaonkar(a)gmail.com> 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 dagon(a)dagon.net <http://www.dagon.net/>
From: Tom Anderson on 14 Jul 2008 14:11
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 |