I have an NIC card on a Debian machine somewhere. The machine is turned off, but I need to know whether the NIC card is turned on so that I can send a wake-on-lan magic packet later (from another Debian machine) to wake it up. I have the MAC address of the card. Is there any way I can ping the ethernet card by MAC to see whether it is on?

I tried creating an ARP entry:

arp -s 00-0c-0d-ef-02-03

That didn't work, since the NIC card does not have this ip address. So the NIC card would receive the ping request but would not reply to it. Is there any way around this?

I am using the etherwake package to send a wake-on-lan message.


6 Answers 6


You might have better luck using the tool arping instead. The tool ping works at the layer 3 level of the OSI model, whereas arping works at layer 2.

You still need to know the IP of the system however with this tool. There are 2 versions of it, the standard one included with most Unixes (Alexey Kuznetsov's) is the version that can only deal with IP addresses. The other version (Thomas Habets') supposedly can query using MAC addresses.

$ sudo arping -c 1
ARPING from eth0
Unicast reply from [00:90:7F:85:BE:9A]  1.216ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)

arping works similarly to ping except instead of sending ICMP packets, it sends ARP packets.

Getting a system's IP using just the MAC

Here are a couple of methods for doing the reverse lookup of MAC to IP.

  1. nmap

    $ nmap -sP

    Then look in your arp cache for the corresponding machine arp -an.

  2. fping

    $ fping -a -g -c 1

    Then look in your arp cache, same as above.

  3. ping

    $ ping -b -c1

    Then look in your arp cache, same as above.

  4. nbtscan (windows only hosts)

    $ nbtscan
    Doing NBT name scan for addresses from
    IP address       NetBIOS Name     Server    User             MAC address      
    ------------------------------------------------------------------------------ Sendto failed: Permission denied      MACH1            <server>  <unknown>        00-0b-12-60-21-dd      MACH2            <server>  <unknown>        00-1b-a0-3d-e7-be      MACH3            <server>  <unknown>        00-21-9b-12-b6-a7
  • 3
    arping can take a MAC address as a parameter: arping -c 5 38:e7:d8:63:5e:a6
    – user44813
    Commented Aug 9, 2013 at 21:03
  • @MichaelMrozek - I did it after someone had basically posted my answer as a comment and hadn't read what I said about 2 versions of arping. The other answer looks to have been deleted so thanks for taking out my bold frustrations.
    – slm
    Commented Aug 10, 2013 at 18:10
  • Thanks for the help. Marking this as resolved. We couldn't find a WOL option in the BIOS setup. This is my guess: The BIOS did not have WOL turned on, but the NIC did. So the NIC was waking up on the first WOL packet, and was sending a message to the BIOS. But since it was not turned on in the BIOS, the BIOS did not do anything. From this moment onwards, the NIC responded to ping since it was awake, but the machine was not. So quick question: Is it possible for the BIOS to have WOL turned off and the NIC to have it turned on at the same time? Commented Aug 14, 2013 at 21:06
  • 1
    @AlastorMoody - I would say that you're probably allowed to turn BIOS WOL off w/ NIC's WOL turned on. However if you BIOS doesn't support WOL, then I don't think you'll be able to make use of it even if the NIC does. See the wikipedia article on WOL: en.wikipedia.org/wiki/Wake-on-LAN. Says the same thing as I in the "troubleshooting magic packets" section.
    – slm
    Commented Aug 14, 2013 at 23:12
  • @niervol: arping to a MAC address: Yes, there are two implementations of arping 1. from Linux iputils 2. arping by Thomas Habets. --- Only the 2. implementation can ping a MAC address but such a ping is very tricky: The pinged machine still has to have TCP/IP configured (at least an IP address) and it must be able to respond to a ping to a broadcast IP address. Commented Aug 19, 2015 at 13:02

You cannot ping a normal NIC because NIC alone does not send any replies.

Only a running computer is able send replies

Normal network interface cards do not send any replies by themselves. They always need a running software on the computer to do so.

When the CPU of the computer is powered down then there is no running software which would send a reply to a ping.

Wake-on-LAN is unidirectional

Wake-on-LAN allows the computer to let just the NIC be partially powered on to receive Ethernet frames and look for the magic wake-up sequence in them but the NIC will still not send any reply. Wake-on-LAN is strictly unidirectional. There are no responses sent.


There are certain special NICs which could send replies by themselves like for example ones implementing a complete TCP handshake offload.

  • 1
    +1 — this is the only answer that truly addresses the OP's question. "Wake-on-LAN is unidirectional".
    – Celada
    Commented Aug 19, 2015 at 11:46

The ether-wake command will work by mac address, so surely you (a) won't need an IP address and (b) can send the command without harm (if it's already awake, waking it will have no impact?)

You can see the list of your existing arp cache by using arp -an and grepping for your MAC to get the IP of the target host. However, because arp is a cache, it may have been "timed out" of the cache (and still be 'awake'). You then may have to use a brute force method to find it's IP, such as:

 sudo nmap -sP | less  

(and then look for 00:0c:0d:ef:02:03) - provided firewalls and other such things don't get in the way!

  • I don't want to wake the machine up right now. But I want to ensure that the NIC can receive my messages so that when I go offsite and turn on the machine via a WOL packet, I know it is going to turn on. That's why I want to ping by IP or MAC and not wake it up. Commented Aug 9, 2013 at 19:51
  • 2
    Sleeping machines will not respond to ping. If the machine is turned on and you ping by IP (and the host reponds), it will put an entry in the arp cache. If the entry in there matches the MAC address of the host, there is a reasonable chance it will work (baring other network firewalls, routers and other physical issues that may cause the ether-wake not to reach it). I would actually get access to another host onsite, put the target machine to sleep and attempt the ether-wake. By the nature of how WOL works, the request will have to be sent on the same subnet as the host anyway
    – Drav Sloan
    Commented Aug 9, 2013 at 20:06
  • 2
    @DravSloan the Bonjour Proxy available on e.g. Apples Time Capsule is a quite ingenious way to handle this proble. The machine sleeps but the router responds for it, and only wakes it up when the proxy can't handle it anymore. Commented Aug 9, 2013 at 23:07
  • Don't rely on WOL without having it tested first. Rather get an IPMI card in that case.
    – sjas
    Commented Jun 6, 2016 at 13:59

My application was a server RSYNCing into a workstation to get the workstation's Document directory... but the workstation did not have a guaranteed IP address but did have a known MAC address (IP address was done by DHCP). this code uses ping ONLY.

export COUNTER=1
while [ $COUNTER -lt 255 ]
    #ping $1$COUNTER -c 1 -w 400 | grep -B 1 "Lost = 0" &
    # activate all 254 addresses  in the subnet..  dont really need to grep the ping output
    ping 192.168.0.$COUNTER -c 1 -w 4 2> /dev/null | grep -B 1 ' 0\% packet loss' > /dev/null &
    COUNTER=$(( $COUNTER + 1 ))
# wait till 254 background processes finished
# the arp cache will automatically flush it's incomplete entries in about 10 minutes...
#echo "finished"

SRC_SERVER_IP=$(arp -a | grep "00:22:4d:81:8f:76" | awk '{print $2}' | sed 's/[()]//g')":873"

if [ $SRC_SERVER_IP == ":873"   ] ; then
    echo  "ws1.example.com is not on the network...  exiting..."
    exit 0

Here is a simple script to ping via mac address. Just save and run e.g
macping aa:bb:cc:dd:ee:ff

You can also daisy chain the result to conditionally do other things, e.g:

macping aa:bb:cc:dd:ee:ff && echo do something if online || echo do something if offline



if [ "$#" -ne 1 ]; then echo Usage example: $0 aa:bb:cc:dd:ee:ff; exit 2; fi;

nmap -sP $network >& /dev/null
ip=$(arp -n | grep $1 | awk ' { print $1 }')
ping $ip -n -q -c 2 -i 0.2 -w 1 >& /dev/null
if [ $? -eq 0 ]; then
    echo Device is online \($ip\)
    echo Device is offline
    exit 1

This doesn't rely on differing versions of arping nor on complex bash scripts:

ping $(arp-scan --localnet | grep 80:1f:02:fa:90:b7  | awk ' { printf $1 } ')

I've used arp-scan rather than arp as it seems to run a lot faster.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .