-1

Is there a way to ping an IP , and know the PC mac address of this IP ?

For exapmle in my network there is a printer which has the ip 192.168.1.99 (dynamic) , i need to

its mac address to give it a reservation in dhcp .

nux
  • 38,017
  • 35
  • 118
  • 131
  • If its not on your local network you cant as the traffic will go via your router so the entire internet appears to have the same mac address as your router. However, for your local network you can. – Warren Hill Jan 30 '14 at 08:43

2 Answers2

2

If the client is in your local network:

  1. ping it.
  2. Then run this command : ip neigh show
nux
  • 38,017
  • 35
  • 118
  • 131
1

To do this I first ping the IP. In this example I will use the IP 10.1.1.1:

ping -c 1 10.1.1.1

Then get the MAC address from the ARP cache:

arp -a 10.1.1.1 | awk '{print $4}'

The output should be the Mac Address

nux
  • 38,017
  • 35
  • 118
  • 131