Re: how to detect MAC address

J

Jon A. Cruz

Amey said:
but i dont
understand if java provides a class NetworkInterface that gives the
name of the interface card then why did they not make provision for
mac address ???? if u can reach the card why not exploit it to get
full details possible....

Ummm....

How do you know that they're even on a card that has a MAC address???

You don't.


I know that when I was using a dial-up connection, my PC would get an IP
address, but definitely had no MAC address.


Since MAC address is not universal to all devices and platforms, it's
not in Java. Just like environment variable access was deprecated around
the time they first ported Java to the Macintosh.
 
D

David Zimmerman

Jon said:
Ummm....

How do you know that they're even on a card that has a MAC address???

You don't.


I know that when I was using a dial-up connection, my PC would get an IP
address, but definitely had no MAC address.


Since MAC address is not universal to all devices and platforms, it's
not in Java. Just like environment variable access was deprecated around
the time they first ported Java to the Macintosh.

I thought that MAC addresses were part of the Ethernet standard, so if
you are networking over ethernet, you have a MAC address. Networks that
aren't ethernet are few are very far between (EG IBM tokenring).
 
D

David Zimmerman

David said:
I thought that MAC addresses were part of the Ethernet standard, so if
you are networking over ethernet, you have a MAC address. Networks that
aren't ethernet are few are very far between (EG IBM tokenring).

You said "modem"! Of course a modem doesn't have a MAC address, it
isn't ethernet.
 
J

Jon A. Cruz

David said:
You said "modem"! Of course a modem doesn't have a MAC address, it
isn't ethernet.


Bingo!!!

Exactly.

Java deals with "networking". IIRC, it does not deal at all with
"ethernet" (or at least not 'till recently).

At the time Java was released, I was still dealing with appletalk over
PhoneNet ($30 a piece instead of $130 for ethernet, and no need for a
$200+ hub). And even some PC's with arcnet cards. Microsoft Windows
still had no networking standard (remember Trumpet Winsock?), just about
every online provider had it's own way of communicating, geeks and
researchers were about the only ones on the Internet, and it was just
being opened for commercial ues.


MAC addresses are part of ethernet, not TCP/IP. An IP address is a
32-bit or 128-bit dynamically assignable number that lives in software.
A MAC address is a 48 bit number that lives on ethernet hardware (and is
sometimes changeable, but that's a little rare).



Anyway...

There are many different ways to do networking, and especially so in
devices (remember, Java was 'originally' designed for devices,
appliances, etc.)

Given all this, it's not suprising that Java does not expose the details
of ethernet, but instead only common concepts that are more cross-platform.
 
K

Keeger

Just out of curiosity....have you investigated an alternate
programming language for your needs? Maybe PHP provides the MAC
addy...

Java isn't the only solution for developing software, if it doesn't
have something you need, move on and find what does.
 
R

Rene

Jon A. Cruz said:
How do you know that they're even on a card that has a MAC address???

You don't.

I know that when I was using a dial-up connection, my PC would get an IP
address, but definitely had no MAC address.

Right, when doing PPP dialup (Point to Point Protocol), there are no MAC
addresses. Some software emulates or displayes 00:00:00:00:00:00 or some
arbitrary value instead.

MAC addresses is a concept of ethernet. A modem or an ISDN TA don't have
nor need any.

CU

Rene
 
R

Rene

Jon A. Cruz said:
still had no networking standard (remember Trumpet Winsock?), just about

Argh, the early versions were a nightmare to set up !
MAC addresses are part of ethernet, not TCP/IP. An IP address is a
32-bit or 128-bit dynamically assignable number that lives in software.
A MAC address is a 48 bit number that lives on ethernet hardware (and is
sometimes changeable, but that's a little rare).

No its not rare, about every single one allows this. (Not in hardware, but
in software, since it is the OS that puts the data together, not the card)

If you are under linux, just enter (as root)

ifconfig eth0 hw ether 12:23:34:45:56:67 up

and your network card has that mac address.

Under windows, just venture into the "extended" tab on the option dialog of
your network card and you should find the place to enter your value as
"network address" or something like that. If it isn't there, you can always
change it directly by creating the correct registry key.

Then reboot and your NIC has a "new" MAC address.

Its really easy to do, its just that not a lot of people know about it.
There are many different ways to do networking, and especially so in
devices (remember, Java was 'originally' designed for devices,
appliances, etc.)

I doubt cellphones have a MAC either...
Given all this, it's not suprising that Java does not expose the details
of ethernet, but instead only common concepts that are more
cross-platform.

Its very low level anyhow.
 
J

Jon A. Cruz

Rene said:
No its not rare, about every single one allows this. (Not in hardware, but
in software, since it is the OS that puts the data together, not the card)

If you are under linux, just enter (as root)

ifconfig eth0 hw ether 12:23:34:45:56:67 up

and your network card has that mac address.

Ahhh.. but then that's something different. That's "lying about your
hardware's assigned identifier". :)


But I was meaning more that it happens rarely.
 
S

Sudsy

Rene said:
Well lying is a bit strong :) Its just overriding the default one.

Yeah it is done rarely, but that's because it is needed seldom and because
few people know it is that easy to do (or even possible)

CU

Rene

Why is it lying at all? Are you trying to "force" people to use
their originally-assigned MAC address on their interface card?
It's kind of like suggesting that people are "stealing" satellite
signals beamed directly at them.
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top