Home  >  Q&A  >  body text

chrome - How to get the client ip and mac address through java under linux system?

This is the command I passed

cmd = { "/bin/sh", "-c", "ping " + ip + " -c 2 && arp -a" };

The mac address obtained, but the mac address is not the client address I want, but the address on my cluster server. Is there any good way to obtain the client mac address through IP?

某草草某草草2713 days ago939

reply all(1)I'll reply

  • 世界只因有你

    世界只因有你2017-05-16 13:25:46

    In fact, if you want to get the client's mac address, there is no way, because when the datagram passes through the router, the mac address in the message will be rewritten by the router, because the mac address of the sender in the link layer needs to be recorded , the general process is as follows:

    You can also refer to this article:
    Network-The MAC address and IP address of the data packet change or remain unchanged during the routing and forwarding process

    reply
    0
  • Cancelreply