iPhone Presence Detection with hping3 and ARP


Will iputils arping will work in my version (which version do you use)?

I’ve installed it:

[15:07:31] openhabian@openHABianPi:~$ arping -Vn
arping utility, iputils-s20121221
[15:07:38] openhabian@openHABianPi:~$ arping
Usage: arping [-fqbDUAV] [-c count] [-w timeout] [-I device] [-s source] destination
  -f : quit on first reply
  -q : be quiet
  -b : keep broadcasting, don't go unicast
  -D : duplicate address detection mode
  -U : Unsolicited ARP mode, update your neighbours
  -A : ARP answer mode, update your neighbours
  -V : print version and exit
  -c count : how many packets to send
  -w timeout : how long to wait for a reply
  -I device : which ethernet device to use
  -s source : source ip address
  destination : ask for what ip address
[15:07:45] openhabian@openHABianPi:~$

Thats the iputils arping. It has different command line parameters. Check with man arping.

ARPING(8)                        System Manager's Manual: iputils                       ARPING(8)

       arping - send ARP REQUEST to a neighbour host

       arping [-AbDfhqUV] [-c count] [-w deadline] [-s source] -I interface destination

       Ping destination on device interface by ARP packets, using source address source.

       -A     The same as -U, but ARP REPLY packets used instead of ARP REQUEST.

       -b     Send  only MAC level broadcasts. Normally arping starts from sending broadcast, and
              switch to unicast after reply received.

       -c count
              Stop after sending count ARP REQUEST packets. With deadline  option,  arping  waits
              for count ARP REPLY packets, until the timeout expires.

       -D     Duplicate address detection mode (DAD). See RFC2131, 4.4.1.  Returns 0, if DAD suc‐
              ceeded i.e. no replies are received

       -f     Finish after the first reply confirming that target is alive.

       -I interface
              Name of network device where to send ARP REQUEST packets.

       -h     Print help page and exit.

       -q     Quiet output. Nothing is displayed.

 Manual page arping(8) line 1 (press h for help or q to quit)

Correct, iputils arping. Could this be a root cause for my problem?


Presence detection never guarantees a correct answer. Please always try the command line first with the given tools (ping, arping). If those fail, the binding will fail.
We should be on-par with hping3 though. That was the goal with the recent additions.


With iputils arping it is much better, now I know that Alexa is online :slight_smile:

I do see some issues with iphone detection, will check it and update.

Thx for the help!!!

@smhgit Can you confirm that the iputils arping works not as good for iphone detection than thomas arping? That would answer @muelli1967’s question.

Was just coming to write it :slight_smile:

Yes, with iputils when iphone is off, no ping from arping:

 [15:19:06] openhabian@openHABianPi:~$ arping -c 1 -I eth0
ARPING from eth0
Sent 1 probes (1 broadcast(s))
Received 0 response(s)

I do recall that arping with thomas was better but I have removed the version :frowning: so I cannot confirm it now (and not sure spo better to check it again).

Thanks! i will give it a try with thomas arping and let you know.

I have been following along your conversation and with my current (brand new) system set up, I am also on the old verson 2.14 of Thomas’ arping. How can I update arping to the latest supported version 2.19? If the answer is “compiling yourself”, I would need some instructions since I did not set up my pi other than installing OpenHAB (the Pi’s sole purpose).

Here are my specs (running on Raspbian Stretch Lite):

##   Release = Raspbian GNU/Linux 9 (stretch)
##   Kernel = Linux 4.9.41-v7+

$ which arping
> /usr/sbin/arping

$ arping
> ARPing 2.14, by Thomas Habets <thomas@habets.se>

I have installed arping and hping3 through

$ sudo apt-get install arping hping3

Thanks for your help!

1 Like

I have tested thomas arping as well, but the iphone detection is not great here as well. same issue. The iphone gets detected, but goes to status OFFLINE quite quickly after the iphone goes to sleep modus.

I am back now to the 2.1.0 network binding and here the detection of the iphone works perfectly fine as it was before. It stays ONLINE as long as in range of the network, even in sleep modus. The enhancements in SNAPSHOT 2.2.0 are unfortunately not working for me right now. I will continue to follow the conversation for further development and happy to test at a later stage.

Thanks to all for your time and effort to work on the projects. Much appreciated.

Download for your platform here.
(I download on my Win & copied it to openHAB2-userdata samba share)
Example for my Ubuntu server 16.04 LTS:

omr@shs2:~$ sudo dpkg -i /var/lib/openhab2/arping_2.19-1_amd64.deb
[sudo] password for omr:
(Reading database ... 68239 files and directories currently installed.)
Preparing to unpack .../arping_2.19-1_amd64.deb ...
Unpacking arping (2.19-1) over (2.14-1) ...
Setting up arping (2.19-1) ...
Removing obsolete conffile /etc/default/arping ...
Removing obsolete conffile /etc/network/if-up.d/arping ...
Processing triggers for man-db (2.7.5-1) ...

omr@shs2:~$ sudo arping -v
ARPing 2.19, by Thomas Habets <thomas@habets.se>
usage: arping [ -0aAbdDeFpPqrRuUv ] [ -w <sec> ] [ -W <sec> ] [ -S <host/ip> ]
              [ -T <host/ip ] [ -s <MAC> ] [ -t <MAC> ] [ -c <count> ]
              [ -C <count> ] [ -i <interface> ] [ -m <type> ] [ -g <group> ]
              [ -V <vlan> ] [ -Q <priority> ] <host/ip/MAC | -B>
For complete usage info, use --help or check the manpage.
1 Like

Took the arping 2.19 (by Thomas Habets) for a spin pinging a sleeping iPhone 6S.

omr@shs2:/var/lib/openhab2/etc$ sudo arping -vv
arping: clock_getres() = 0s 1ns
arping: libnet_init(<null>)
arping: Autodetected interface enp3s0
arping: libnet_init(enp3s0)
Timestamp types:
  Name               Description
  host               Host
arping: Successfully chrooted to /var/run/sshd
arping: Successfully dropped uid/gid to 65534/65534.
arping: pcap_get_selectable_fd(): 5
This box:   Interface: enp3s0  IP:   MAC address: 78:24:af:04:e6:94
arping: sending packet at time 1664524.533523928
 - removed timeouts -
arping: sending packet at time 1664545.544827499
60 bytes from f4:31:c3:4e:34:bf ( index=0 time=171.203 msec
arping: sending packet at time 1664546.545722459
 - removed timeouts -
Time since last reply 639-545=94s
arping: sending packet at time 1664639.599271890
60 bytes from f4:31:c3:4e:34:bf ( index=1 time=124.669 msec
arping: sending packet at time 1664640.599523014
 - removed timeouts -
time since last reply 710-639=71s
arping: sending packet at time 1664710.637140904
60 bytes from f4:31:c3:4e:34:bf ( index=2 time=972.041 msec
60 bytes from f4:31:c3:4e:34:bf ( index=3 time=972.073 msec
arping: sending packet at time 1664711.637252153

These are my properties:

  • The uses_ios_wakeup is On

So is the arping reply interval of up to 94s as expected?
I also did the port 67 forwarding described in the binding doc, but uses_dhcp_listen is still a: no

Just updated to new snapshot with @David_Graeff’s fix.

 openhab> bundle:list | grep -i netw
186 â Active   â  80 â     â Network Binding

Properties are now:

When I check top (-V) I can see ping being run regularly, but never arping.
My toolpath is set to /usr/sbin/arping and the openhab user given privilege in sudoers:

openhab@shs2:~$ /usr/sbin/arping
ARPing 2.19, by Thomas Habets <thomas@habets.se>
usage: arping [ -0aAbdDeFpPqrRuUv ] [ -w <sec> ] [ -W <sec> ] [ -S <host/ip> ]
              [ -T <host/ip ] [ -s <MAC> ] [ -t <MAC> ] [ -c <count> ]
              [ -C <count> ] [ -i <interface> ] [ -m <type> ] [ -g <group> ]
              [ -V <vlan> ] [ -Q <priority> ] <host/ip/MAC | -B>
For complete usage info, use --help or check the manpage.


Why is my arping never called?

Try arping -c 1 -I eth0, adapt the IP.

edit: showing now after one additional restart of openhab
however i still have the same problem as @OMR in regards to the DHCP_state. all settings in regards to port forwarding are done as mentioned in the binding doc, but still getting the “No Access …” message.


Got it working and it seems to work really reliable for my P10plus.
however i noticed that in the config nothing is showing for the “Presence _detection_type”
is there a reason for that? (runninh lates bundel

There’s another way: grant your java binary full network access. How to do that is described in the Openhab setup documentation.

The port forwarding section of the binding docu need to be reworked. It doesn’t work in all conditions the documented way.


Thanks a lot, looks better, lets see how its working now with this settings and the latest snapshot.


HI David,

I am using RPI-3B with openhabian-jessie lite version,
I have installed ARPing with 2.19 version,

I have use sudo visudo and add below line,

openhab ALL=NOPASSWD: /usr/sbin/arping

but openhab still don’t have access right,

I set a rule for test purpose, run command as below

var String arping = executeCommandLine("arping -c 1 -I eth0 192.168.xxx.xx", 120*1000)

17:58:45.908 [INFO ] [clipse.smarthome.model.script.AirCon] - result:arping: libnet_init(LIBNET_LINK, eth0): libnet_open_link(): UID/EUID 0 or capability CAP_NET_RAW required
arping: you may need to run as root

do you know why? and what should I do now?

Perhaps you should use the openhabian user instead?

I’m pretty sure the openhab user is the right user in this case. OH runs as openhab, not openhabian, so openhab is the one that needs the permission to run arping.

1 Like