How to ping MAC address in Linux

后端 未结 5 1451
南方客
南方客 2021-01-31 12:19

I want to ping a known MAC address, I tried to use nmap:

sudo nmap -sP 192.168.15.1/24 | grep  20:64:32:3F:B1:A9

But in this case its ping all

5条回答
  •  忘了有多久
    2021-01-31 13:05

    You can't ping a MAC address. You can only ping an IP address, so what you're trying to do is find out what IP address belongs to a certain MAC Address and ping that IP. ARP is used to find the MAC address of a machine with a certain IP address, but you can't really go the other way around (technically a protocol called Reverse ARP exists, but it's never used in typical operating systems). Once the MAC address is found, it'll be kept in the ARP cache so you don't have to look it up again for a few minutes, but that's not a reliable way to find the MAC because entries don't stay in the cache long. You figured out how to make a static entry, but if you're hard coding 192.168.15.196 to that MAC address, why don't you just ping 192.168.15.196 (that's all you're doing anyway)?

提交回复
热议问题