473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

MAC address

Hi,
Is it possible to have the MAC adress of the client that connect to a php
page?
I have the IP adress, if it's not possible to have directly is it possible
to query the DCHP server and have the MAC back? (it's for an intranet
purpose).
Any idea or help welcome!
Thanks,
VooDoo
Jul 17 '05 #1
5 5626
>Is it possible to have the MAC adress of the client that connect to a php
page?
If the client is on the same LAN that your web server is, maybe.
If the client is at an arbitrary place on the Internet, *NO*. In
this situation, the MAC address is likely never transmitted to the
web server. What you'll probably see if you can get hold if the
MAC address is the IP address of YOUR router.

And there's no guarantee that every machine even HAS a MAC address:
some guy with a 56K modem and no ethernet card won't have one, and
his terminal server at the ISP may have one - but it serves a
thousand dialup users. And your chances of even getting that are
slim to none.
I have the IP adress, if it's not possible to have directly is it possible
to query the DCHP server and have the MAC back? (it's for an intranet
purpose).


As far as I know, DHCP servers don't hand out that information.

If the client in question talks DIRECTLY to the server (hubs and
switches are OK, routers are not), then if it just asked for a web
page, the MAC address is almost certainly in the server's ARP cache.
I'm not sure how you get this info, but on UNIX systems grunging
through the output of "arp -a" or "arp -an" or perhaps "netstat
-nr", and picking the line with the relevant IP address or host
name might get you what you want.

You might also get this info out of the server or a managed switch
with SNMP. Of course, this means you need access to it (community
strings and SNMP has to be running on the machine you're asking).

Gordon L. Burditt
Jul 17 '05 #2
of course is not for internet user.
This is just on an intranet LAN.
Machine are on the same subnet.
And of course the DHCP Server has the mac adress, how will it give the IP
without it....
the question is, is this database "queryable"? Don't have a clue oon how i
could query the dhcp server to know the MAC of a specific lease....
If somebody know the anwer that would be fantastic!

The other option is the use the arp commands, but is this usable under php
command?

"Gordon Burditt" <go***********@burditt.org> a écrit dans le message de
news:ce********@library1.airnews.net...
Is it possible to have the MAC adress of the client that connect to a php
page?


If the client is on the same LAN that your web server is, maybe.
If the client is at an arbitrary place on the Internet, *NO*. In
this situation, the MAC address is likely never transmitted to the
web server. What you'll probably see if you can get hold if the
MAC address is the IP address of YOUR router.

And there's no guarantee that every machine even HAS a MAC address:
some guy with a 56K modem and no ethernet card won't have one, and
his terminal server at the ISP may have one - but it serves a
thousand dialup users. And your chances of even getting that are
slim to none.
I have the IP adress, if it's not possible to have directly is it possibleto query the DCHP server and have the MAC back? (it's for an intranet
purpose).


As far as I know, DHCP servers don't hand out that information.

If the client in question talks DIRECTLY to the server (hubs and
switches are OK, routers are not), then if it just asked for a web
page, the MAC address is almost certainly in the server's ARP cache.
I'm not sure how you get this info, but on UNIX systems grunging
through the output of "arp -a" or "arp -an" or perhaps "netstat
-nr", and picking the line with the relevant IP address or host
name might get you what you want.

You might also get this info out of the server or a managed switch
with SNMP. Of course, this means you need access to it (community
strings and SNMP has to be running on the machine you're asking).

Gordon L. Burditt

Jul 17 '05 #3
On 5 Aug 2004, cr*******@ifrance.com wrote:
Hi, Is it possible to have the MAC adress of the client that connect
to a php page? I have the IP adress, if it's not possible to have
directly is it possible to query the DCHP server and have the MAC
back? (it's for an intranet purpose). Any idea or help welcome!
Thanks, VooDoo


Use arpwatch to make a table of your internal IP -> MAC pairings, and
then try looking up IPs on that table.

If you are familiar with the TCP/IP protocol stack, you'll understand
that you can only discover the MAC addresses of hosts on the same
local network, since the MAC address has to do with the lowest layer
-- the Link/Hardware layer of the stack -- and routers only forward
information from the Network (IP) layer of the stack & up. Therefore,
If your intranet is composed of multiple physical networks, you'll
need a machine running arpwatch on each physical network, and then
you'll need to collect all the data in a centralized location for
lookup.
Jul 17 '05 #4
>of course is not for internet user.
This is just on an intranet LAN.
Machine are on the same subnet.
That doesn't always guarantee the path from the server to the client
doesn't go through a router.
And of course the DHCP Server has the mac adress, how will it give the IP
without it....
the question is, is this database "queryable"?
This is doubtful. There's no reason to implement such functionality.
A network driver needing the info will just use an ARP.
Don't have a clue oon how i
could query the dhcp server to know the MAC of a specific lease....
If somebody know the anwer that would be fantastic!

The other option is the use the arp commands, but is this usable under php
command?


If you can run an arbitrary command (in safe mode you can't), you
could use popen() to run "arp -a" and then parse through the output.
You might also get this info out of the server or a managed switch
with SNMP. Of course, this means you need access to it (community
strings and SNMP has to be running on the machine you're asking).

PHP does have functions to query SNMP if it is compiled with those
options.

Gordon L. Burditt
Jul 17 '05 #5
Gordon Burditt wrote:
of course is not for internet user.
This is just on an intranet LAN.
Machine are on the same subnet.


That doesn't always guarantee the path from the server to the client
doesn't go through a router.


but...what is it you are trying to acheive? Access control by host is a
waste of time, particularly as PHP implements sessions so well using
cookies. Also mac addresses can be spoofed a lot more easily than IP
addresses.

C.
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Alexander N. Spitzer | last post by:
If I have a machine with 3 virtual IP addresses (192.168.1.), how can I start 3 instances of the same RMI application (each started with different properties/configs), each listening on the port...
8
by: YAN | last post by:
Hi, I want to get the mac address from a machine, which i have the IP address of that machine, how can i do that? I know how to get the mac address of the local machine from the following code: ...
7
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of...
33
by: baumann.Pan | last post by:
hi all, i want to get the address of buf, which defined as char buf = "abcde"; so can call strsep(address of buf, pointer to token);
4
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> ...
1
by: Phoenix_ver10 | last post by:
I have a mailing list with multiple names going to the same addresses. I need one address with all the names for that address on it. I checked out the example on microsoft's site, but A: It doesn't...
1
by: Jamie J. Begin | last post by:
I'm very new to the world of Python and am trying to wrap my head around it's OOP model. Much of my OOP experience comes from VB.Net, which is very different. Let's say I wanted to create an...
6
by: Nicolas Noakes | last post by:
Hello, I would like to convert to following process to code. Any advice is welcome. I have a hardware device which requires the this procedure to set it's IP address. First create an static...
36
by: Julienne Walker | last post by:
Ignoring implementation details and strictly following the C99 standard in terms of semantics, is there anything fundamentally flawed with describing the use of a (non-inline) function as an...
1
by: saravanatmm | last post by:
I need javascript code for validate the email address. Email address field cannot allowed the capital letters, special characters except '@' symbol. But can allowed the small letters, numeric...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.