question

M

moneybhai

guys is there any way of converting IP address to mac address or vice
versa..............
 
A

Arne Vajhøj

moneybhai said:
guys is there any way of converting IP address to mac address or vice
versa..............

A single mac address can have zero, one or many IP addresses
associated with it.

The NetworkInterface code I posted can get both.

Arne
 
R

Roedy Green

guys is there any way of converting IP address to mac address or vice
versa..............

I doubt it. Other people's MAC addresses are none of your business.
 
N

Nigel Wade

Roedy said:
I doubt it. Other people's MAC addresses are none of your business.

If you wish to communicate over an Ethernet you need the MAC address of the
destination. That's what arp/rarp are for.

It should be handled automatically at (IIRC) layer 2 of the OSI 7-layer model,
you don't normally deal with them at the application layer. You only need, and
can probably only get, MAC addresses for interfaces on the same subnet. For any
other host the MAC address you will get from arp is the MAC address of the
router responsible for routing packets to that host.
 
R

Roedy Green

I doubt it. Other people's MAC addresses are none of your business.

On a LAN of course, your machine needs to know other people's MAC
addresses to send Ethernet packets to them. So at least at the low
levels, your machine knows everybody's MAC that you talk to. It
determines them without even requiring a preconfigured list. Ethernet
protocol can dynamically detect the MACs of everybody alive and well
on a LAN.

On the web, you have no need to know other people's MAC addresses. It
is used in various software licensing schemes as a unique machine id.
If you could determine other people's MAC addresses easily, you could
presumably more easily trick unlicensed software into running on your
machine. That is why a think it unlikely there is a easy way to get
them.
 
R

Roedy Green

It requires some very low level bit twiddling and root/admin privs to send
your own link layer packets. I doubt you'll be able to do it in java.

In Windows, you might poke around with the NET command to see what you
can find out. You invoke it by exec and parse the results. That of
course will only tell you about machines on the LAN in your own group.
 
A

Arne Vajhøj

Eric said:
Not directly, no. But in at least two of the forty-leven
threads he started on this one topic he asked how to do it with
an "aglet." He probably wasn't referring to the thing at the
end of a shoelace, but to a framework and toolkit (possibly
obsolete?) for writing mobile applications that wander all over
the Internet from device to device to device.

... which makes "somebody else's MAC address" a reasonable
supposition, even if unproven.

Well - when I showed code that got IP and MAC of the local
system he asked for code doing the same on 1.4.

It is not obvious to me why an aglet should have more use
of a remote MAC than a local MAC. But given that I don't
know the framework, then that does not tell much.

Arne
 
E

Eric Sosman

Arne said:
Well - when I showed code that got IP and MAC of the local
system he asked for code doing the same on 1.4.

It is not obvious to me why an aglet should have more use
of a remote MAC than a local MAC. But given that I don't
know the framework, then that does not tell much.

I don't know it, either.

As to "other people's MAC addresses are none of your
business," I'm not so sure. If the "other people" are on the
same LAN, then their MAC addresses (assuming it's a MAC-ish
LAN) are most necessarily your business: You can't communicate
with them in ignorance of their MAC addresses. In the normal
course of things this knowledge remains in the lower layers of
the protocols and you don't worry about it: You deal in IP
addresses and let the underlying machinery deal with transport.
That machinery cares (or doesn't care!!) about MAC addresses,
but in any event bears the responsibility of getting the packets
from hither to yon and back, by whatever means seem fitting.

It's my guess that the O.P. doesn't want MAC addresses for
communication purposes, since they're not needed at the protocol
levels application programs usually employ. More likely, this
is just Yet Another Software Locker-Downer, someone who thinks
that he can "issue a license" to thus-and-such MAC address and
use it to authenticate. If so, he's deluded: MAC addresses are
neither unique nor immutable. If I get hold of my friend's copy
of his encrypted-by-MAC license, and am on a different LAN, it is
child's play to set my NIC to that same MAC address and use the
license without paying one red cent. So if that's what the O.P.
is after, he's after a will-o'-the-wisp.

"Nur Täuschung ist für mich Gewinn!"
 
A

Arne Vajhøj

Eric said:
I don't know it, either.

As to "other people's MAC addresses are none of your
business," I'm not so sure. If the "other people" are on the
same LAN, then their MAC addresses (assuming it's a MAC-ish
LAN) are most necessarily your business: You can't communicate
with them in ignorance of their MAC addresses. In the normal
course of things this knowledge remains in the lower layers of
the protocols and you don't worry about it: You deal in IP
addresses and let the underlying machinery deal with transport.
That machinery cares (or doesn't care!!) about MAC addresses,
but in any event bears the responsibility of getting the packets
from hither to yon and back, by whatever means seem fitting.

It's my guess that the O.P. doesn't want MAC addresses for
communication purposes, since they're not needed at the protocol
levels application programs usually employ. More likely, this
is just Yet Another Software Locker-Downer, someone who thinks
that he can "issue a license" to thus-and-such MAC address and
use it to authenticate. If so, he's deluded: MAC addresses are
neither unique nor immutable. If I get hold of my friend's copy
of his encrypted-by-MAC license, and am on a different LAN, it is
child's play to set my NIC to that same MAC address and use the
license without paying one red cent. So if that's what the O.P.
is after, he's after a will-o'-the-wisp.

"Nur Täuschung ist für mich Gewinn!"

That could very well be it.

Arne
 
R

Roedy Green

If I get hold of my friend's copy
of his encrypted-by-MAC license, and am on a different LAN, it is
child's play to set my NIC to that same MAC address and use the
license without paying one red cent. So if that's what the O.P.
is after, he's after a will-o'-the-wisp.


Intel CPUs have a unique serial number. To get hold of it see the
Pentium class. http://mindprod.com/products.html#PENTIUM

It would be harder to counterfeit. You might do it by intercepting
the CPUID instruction in a virtual machine.

AMDs don't have a serial number though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,242
Latest member
KendrickKo

Latest Threads

Top