How to Know a Mac Address for a Node Knowing Its Ip on Local Network? [Duplicate]

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 .

1

If the client is in your local network:

  1. ping it.
  2. Then run this command : ip neigh show

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

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest