I have configured an watchdog daemon on a Debian GNU/Linux ARM computer.
The idea is that if you don't ping a particular computer, it will restart. I have installed the package watchdog
and I have enabled the daemon systemctl enable watchdog
. The daemon works, and when I restart the computer it starts automatically (I'm saying this to rule out bugs and bugs where this doesn't happen).
I have added to /etc/watchdog.conf
the lines:
ping = 172.16.0.1interface = tun0interval = 40
I also tested using a generic ip without specifying network interface:
ping = 8.8.8.8interval = 40
My IP configuration and my interfaces are:
br0 Link encap:Ethernet HWaddr ----- inet addr:10.2.29.1 Bcast:10.2.29.255 Mask:255.255.255.0 inet6 addr: fe80::e399:736e:2446:bc8/64 Scope:Link inet6 addr: fe80::4d1e:498d:b22e:2f3e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1645 errors:0 dropped:0 overruns:0 frame:0 TX packets:623 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:155325 (155.3 KB) TX bytes:80290 (80.2 KB)eth0 Link encap:Ethernet HWaddr ---- UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1920 errors:0 dropped:0 overruns:0 frame:0 TX packets:971 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:230297 (230.2 KB) TX bytes:98438 (98.4 KB) Interrupt:42 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:475 errors:0 dropped:0 overruns:0 frame:0 TX packets:475 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:57671 (57.6 KB) TX bytes:57671 (57.6 KB)tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.2.0.33 P-t-P:10.2.0.33 Mask:255.255.0.0 inet6 addr: fe80::54f8:e24a:2887:d912/64 Scope:Link UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:179 errors:0 dropped:0 overruns:0 frame:0 TX packets:133 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:14805 (14.8 KB) TX bytes:20445 (20.4 KB)
I can verify the correct ping both directly and with the tun0 interface:
root@NanoPi-R1:~# ping 172.16.0.1PING 172.16.0.1 (172.16.0.1) 56(84) bytes of data.64 bytes from 172.16.0.1: icmp_seq=1 ttl=64 time=22.7 ms64 bytes from 172.16.0.1: icmp_seq=2 ttl=64 time=22.5 ms64 bytes from 172.16.0.1: icmp_seq=3 ttl=64 time=21.7 ms64 bytes from 172.16.0.1: icmp_seq=4 ttl=64 time=21.9 ms^C--- 172.16.0.1 ping statistics ---4 packets transmitted, 4 received, 0% packet loss, time 3004msrtt min/avg/max/mdev = 21.709/22.222/22.751/0.429 msroot@NanoPi-R1:~# ping -I tun0 172.16.0.1PING 172.16.0.1 (172.16.0.1) from 10.2.0.33 tun0: 56(84) bytes of data.64 bytes from 172.16.0.1: icmp_seq=1 ttl=64 time=23.1 ms64 bytes from 172.16.0.1: icmp_seq=2 ttl=64 time=21.8 ms64 bytes from 172.16.0.1: icmp_seq=3 ttl=64 time=21.7 ms64 bytes from 172.16.0.1: icmp_seq=4 ttl=64 time=22.4 ms^C--- 172.16.0.1 ping statistics ---4 packets transmitted, 4 received, 0% packet loss, time 3004msrtt min/avg/max/mdev = 21.730/22.305/23.185/0.587 ms
But the output of systemctl status watchdog
indicates me network is unreachable (target: 172.16.0.1)
(with 8.8.8.8 too):
● watchdog.service - watchdog daemon Loaded: loaded (/lib/systemd/system/watchdog.service; enabled; vendor preset: ena Active: active (running) since Tue 2020-05-26 11:13:40 UTC; 37s ago Process: 715 ExecStart=/bin/sh -c [ $run_watchdog != 1 ] || exec /usr/sbin/watchdo Process: 711 ExecStartPre=/bin/sh -c [ -z "${watchdog_module}" ] || [ "${watchdog_ Main PID: 718 (watchdog) CGroup: /system.slice/watchdog.service└─718 /usr/sbin/watchdogMay 26 11:13:40 NanoPi-R1 watchdog[718]: pidfile: no server process to checkMay 26 11:13:40 NanoPi-R1 watchdog[718]: interface: tun0May 26 11:13:40 NanoPi-R1 systemd[1]: Started watchdog daemon.May 26 11:13:40 NanoPi-R1 watchdog[718]: temperature: no sensors to checkMay 26 11:13:40 NanoPi-R1 watchdog[718]: no test binary filesMay 26 11:13:40 NanoPi-R1 watchdog[718]: no repair binary filesMay 26 11:13:40 NanoPi-R1 watchdog[718]: error retry time-out = 60 secondsMay 26 11:13:40 NanoPi-R1 watchdog[718]: repair attempts = 1May 26 11:13:40 NanoPi-R1 watchdog[718]: alive=[none] heartbeat=[none] to=root no_acMay 26 11:13:40 NanoPi-R1 watchdog[718]: network is unreachable (target: 172.16.0.1)lines 1-19/19 (END)