How to check if host is available by MAC address using arping in FreeBSD

Sometimes checking network devices availability using ping utility is impossible. It happens when ICMP requests are being blocked. I.e. Windows firewall blocks ICMP requests by default, some routers do that as well. We can still check if host is online using ARP protocol. To do this we need an ARP level ping utility - arping. It functions just as ping utility but it works only for the local network.

To install arping in FreeBSD run:

cd /usr/ports/net/arping && make install clean && rehash

After the installation is finished it's strongly recommended to get acquainted with utility's possibilities:

arping —help

arping command sends ARP request to a neighbour host. This command goes with a set of parameters such as -i, -c, -w, etc.

-i parameter specifies name of network device to send ARP request packets through. This option is required, otherwise arping will take first available interface. In our case we need to check the host on vr0 interface:

arping -c 3 -i vr0 192.168.1.2
ARPING 192.168.1.2
60 bytes from 00:23:54:3b:5f:62 (192.168.1.2): index=0 time=122.123 msec
60 bytes from 00:23:54:3b:5f:62 (192.168.1.2): index=1 time=121.334 msec
60 bytes from 00:23:54:3b:5f:62 (192.168.1.2): index=2 time=232.345 msec
— 192.168.1.2 statistics —
3 packets transmitted, 3 packets received, 0% unanswered (0 extra)

-c parameter sets the amount of requests to send. By default the amount of packets is unlimited.

Let's try some more options:

arping -p -uv -c 3 -i vr0 192.168.1.2
This box: Interface: vr0 IP: 192.168.1.1 MAC address: 00:12:45:34:1f:23
ARPING 192.168.1.2
60 bytes from 00:23:54:3b:5f:62 (192.168.1.2): index=0/0 time=727.281 msec
60 bytes from 00:23:54:3b:5f:62 (192.168.1.2): index=1/2 time=57.936 usec
60 bytes from 00:23:54:3b:5f:62 (192.168.1.2): index=2/2 time=723.300 msec
— 192.168.1.2 statistics —
3 packets transmitted, 3 packets received, 0% unanswered (0 extra)

You can get full list of arping options and parameters by running:

arping —help







Got a comment?

captcha =

Categories

  1. System (20)
    1. FreeBSD (5)
    2. Linux (9)
  2. Email (2)
  3. DNS (2)
  4. Databases (1)
  5. WebServer (27)
 
Copyright © 2012-2015 HowToUnix - *nix Howtos and Tutorials
All Rights Reserved.