473,594 Members | 2,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5636
>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.airne ws.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*******@ifran ce.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
15683
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 1234, but each instance binds to a different ip address. that is to say: instance #1 binds to 192.168.1.5/port 1234 instance #2 binds to 192.168.1.6/port 1234 instance #3 binds to 192.168.1.7/port 1234
8
4585
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: Dim mc As System.Management.ManagementClass Dim mo As System.Management.ManagementObject mc = New System.Management.ManagementClass("Win32_NetworkAdapterConfiguration")
7
21287
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 someone (client) that visits a web site through an anonymous proxy if this person ONLY has JavaScript enabled in their browser? This is NOT a question about PHP, perl, VBScript, Java(.class), or ActiveX. Let us _only_ deal with JavaScript for...
33
3146
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
6285
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> Anderas
1
2924
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 work (error that there is an extra parenthise (sp?) ) and B: Will only let in two names for each record. If there are three, the middle on is deleted. Or to make things simpler, if nothing else, I'd like to add a field in the table that shows...
1
2351
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 object that simply outputted something like this: Developer Detroit Michigan
6
7030
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 ARP entry for the device's MAC address and the desired IP address. Then telnet to this IP address on TCP port 1. This will set the device to temporarily respond to that IP address. Now you can use HTTP to access the device's web interface and
36
3371
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 address? I keep feeling like I'm missing something obvious. -Jul To keep things in context, this is in reference to describing functions to a beginner.
1
3118
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 numbers. Now i use this script for validate the email address. But it allows the cpital letters otherwise its working correctly. SCRIPT FUNCTION ************************************************
0
8253
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8009
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6661
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3867
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1482
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1216
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.