MAC address

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • VooDoo

    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


  • Gordon Burditt

    #2
    Re: MAC address

    >Is it possible to have the MAC adress of the client that connect to a php[color=blue]
    >page?[/color]

    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.
    [color=blue]
    >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).[/color]

    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

    Comment

    • VooDoo

      #3
      Re: MAC address

      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" <gordonb.fehct@ burditt.org> a écrit dans le message de
      news:cetlpm$31n @library1.airne ws.net...[color=blue][color=green]
      > >Is it possible to have the MAC adress of the client that connect to a php
      > >page?[/color]
      >
      > 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.
      >[color=green]
      > >I have the IP adress, if it's not possible to have directly is it[/color][/color]
      possible[color=blue][color=green]
      > >to query the DCHP server and have the MAC back? (it's for an intranet
      > >purpose).[/color]
      >
      > 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[/color]


      Comment

      • Walker Pendleton

        #4
        Re: MAC address

        On 5 Aug 2004, cr.stepan@ifran ce.com wrote:[color=blue]
        > 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[/color]

        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.

        Comment

        • Gordon Burditt

          #5
          Re: MAC address

          >of course is not for internet user.[color=blue]
          >This is just on an intranet LAN.
          >Machine are on the same subnet.[/color]

          That doesn't always guarantee the path from the server to the client
          doesn't go through a router.
          [color=blue]
          >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" ?[/color]

          This is doubtful. There's no reason to implement such functionality.
          A network driver needing the info will just use an ARP.
          [color=blue]
          >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?[/color]

          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.
          [color=blue][color=green]
          >> 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).[/color][/color]
          PHP does have functions to query SNMP if it is compiled with those
          options.

          Gordon L. Burditt

          Comment

          • Colin McKinnon

            #6
            Re: MAC address

            Gordon Burditt wrote:
            [color=blue][color=green]
            >>of course is not for internet user.
            >>This is just on an intranet LAN.
            >>Machine are on the same subnet.[/color]
            >
            > That doesn't always guarantee the path from the server to the client
            > doesn't go through a router.
            >[/color]

            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.

            Comment

            Working...