Please follow the below template, it will help us to help you!
Expected Behaviour:
A manual ping from raspberry to my gateway (Unifi USG) is working fine and I get replies as expected.
Actual Behaviour:
Running a debug produces
[i] Default IPv4 gateway: 192.168.2.1
192.168.2.1
* Pinging 192.168.2.1
192.168.2.1...
[✗] Gateway did not respond. (https://discourse.pi-hole.net/t/why-is-a-default-gateway-important-for-pi-hole/3546)
Debug Token:
https://tricorder.pi-hole.net/rqbwt4scs9
jfb
September 12, 2019, 8:14am
2
Here is the code that gravity.sh uses to perform this check.
local gateway
gateway="$(ip -"${protocol}" route | grep default | cut -d ' ' -f 3)"
# If the gateway variable has a value (meaning a gateway was found),
if [[ -n "${gateway}" ]]; then
log_write "${INFO} Default IPv${protocol} gateway: ${gateway}"
# Let the user know we will ping the gateway for a response
log_write " * Pinging ${gateway}..."
# Try to quietly ping the gateway 3 times, with a timeout of 3 seconds, using numeric output only,
# on the pihole interface, and tail the last three lines of the output
# If pinging the gateway is not successful,
if ! ${cmd} -c 1 -W 2 -n "${gateway}" -I "${PIHOLE_INTERFACE}" >/dev/null; then
# let the user know
log_write "${CROSS} ${COL_RED}Gateway did not respond.${COL_NC} ($FAQ_GATEWAY)\\n"
# and return an error code
return 1
# Otherwise,
else
# show a success
log_write "${TICK} ${COL_GREEN}Gateway responded.${COL_NC}"
# and return a success code
thank you, I will check that
Hi,
This is the result:
pi@raspberrypi:~ $ ip route | grep default | cut -d ' ' -f 3
192.168.2.1
192.168.2.1
pi@raspberrypi:~ $ ping -c 1 -W 2 -n 192.168.2.1
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=0.404 ms
--- 192.168.2.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.404/0.404/0.404/0.000 ms
Reason is most likely as I use the LAN interface (eth0) and also a Wifi connection (wlan0).
So I have two gateways, both are the same and working.
However the script is misinterpreting the result as the first command returns two IP addresses, I guess, right?
jfb
September 12, 2019, 6:12pm
5
I am not expert at that section of the code, but I suspect not. Each of the interfaces has a separate IP, and that's what the ping is hitting.
hmm, but then I don't understand why the result fails because I get a gateway and the gateway is pingable.
It's just a cosmetic issue and should not affect how Pi-hole works.
1 Like
system
Closed
October 3, 2019, 6:24pm
8
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.