toolkit/func/core/pkg_network/30-test-arpwatch.sh

24 lines
405 B
Bash
Raw Normal View History

2021-07-05 06:50:25 +00:00
#!/bin/bash
# defaults
defaultGW=$(ip route | awk '/^default via/ { print $3 }')
arpdat="/var/lib/arpwatch/arp.dat"
if [ -z "${defaultGW}" ]; then
r_log "arpwatch" "There is no default gateway set."
exit
fi
arpwatch
sleep 5
arp -d "${defaultGW}"
sleep 5
ping -i 1 -q -c 5 "${defaultGW}"
killall arpwatch
sleep 3
grep -q "${defaultGW}" "${arpdat}"
r_checkExitStatus $?
cat /dev/null > "${arpdat}"