From 2aa3a109a0f8eb9693754ab9a01ac859ad47f83d Mon Sep 17 00:00:00 2001 From: Dan Schaper Date: Thu, 16 Feb 2017 18:38:05 -0800 Subject: [PATCH] Ping gateways and Internet. --- advanced/Scripts/piholeDebug.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index 97f9112a..2733aeaa 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -210,8 +210,10 @@ ip_ping_check() { if [[ ${protocol} == "6" ]]; then cmd="ping6" + g_addr="2001:4860:4860::8888" else cmd="ping" + g_addr="8.8.8.8" fi local ip_def_gateway=$(ip -${protocol} route | grep default | cut -d ' ' -f 3) @@ -223,9 +225,17 @@ ip_ping_check() { else echo "Gateway responded." log_write "${ping_gateway}" - return 0 + fi + echo -n "::: Pinging Internet via IPv${protocol}: " + if ! ping_inet="$(${cmd} -q -W 3 -c 3 -n ${g_addr} -I ${PIHOLE_INTERFACE} | tail -n 3)"; then + echo "Query did not respond." + return 1 + else + echo "Query responded." + log_write "${ping_inet}" fi fi + return 0 } ip_check_wrapper() {