Page 1 of 1

Unable tp ping remote host using ESP32 ping

Posted: Sun Oct 09, 2022 12:41 am
by kian79
Hi all,

I am following an example for this website:
https://techtutorialsx.com/2019/10/05/e ... mote-host/

I am able to successfully connect to my home WIFI network, but ping method just doesn't work and returns an error message "Ping failed" all the time.

Code: Select all

bool success = Ping.ping("www.google.com", 3);
 
if(!success){
    Serial.println("Ping failed");
    return;
}
 
Serial.println("Ping succesful.");
Would anyone know what could be the problem or how can I go about troubleshooting this problem?

Thanks in advance!

Re: Unable tp ping remote host using ESP32 ping

Posted: Sun Oct 09, 2022 7:04 am
by felmue
Hello @kian79

have you tried to ping a different host? have you tried to connect to a different AP?

Thanks
Felix

P.S. the included ping example HostPing.ino works for me.

Re: Unable tp ping remote host using ESP32 ping

Posted: Mon Oct 10, 2022 5:51 am
by a2800276
Some hosts don't respond to pings. Some network configurations may filter the necessary ICMP packets.

- Can you ping the target from a laptop connected to the same Wifi?
- Can you ping a different target from your device?
- Can you open a network connection (e.g. HTTP) from your device?

Re: Unable tp ping remote host using ESP32 ping

Posted: Mon Oct 10, 2022 12:22 pm
by kian79
Hi all,

I tried some of the suggestions above. Using my home Wifi network, I tried changing different host names but ping is still unsuccessful.

However, when I set my mobile phone as a hotspot device and have the ESP32 connected to it, I was able to ping successfully different hostnames, eg www.google.com etc etc.

So I guess it has something to do with my home wifi network. But I don't know exactly what is causing it, the router settings maybe? I need the ESP32 to be connect to my home WiFi and not a mobile hotspot.

Re: Unable tp ping remote host using ESP32 ping

Posted: Mon Feb 12, 2024 6:36 pm
by MagicEsp
I've spent the past 2 hours with trying to fix this - -- I was using an old phone charger with the Esp32 - I swapped it out with another and hey presto It works! I can ping and see the web page - so it may be something you might want to try.

Spooky!