marian-craciunescu / ESP32Ping

Ping library for ESP32 Arduino core
GNU Lesser General Public License v2.1
110 stars 58 forks source link

Pinging hosts on other subnets doesn't work #42

Open DavideTurra opened 1 year ago

DavideTurra commented 1 year ago

Hi, I'm trying to ping an host in a different subnet but ping ever fails, the ping from my PC works normally, any hint?

thanks in advance

shmoun commented 1 year ago

Are you getting your IP from a DHCP server or setting it manually?

You can check if your gateway is set correctly.

If you're using hostnames for pinging you could ping to the actual IP of the host on the other subnet first, if that works it coud be that DNS was not set properly.

Does the gateway between the two subnets know about the subnet you're coming from? Check the routing table.

Did you add a static route on your PC? You could move that to the router.

DavideTurra commented 1 year ago

hi Simon,

all the IPs are static, all the protocols that the device uses works, the esp32 is working at 100% (MQTT, FTP, HTTP ecc) . I can ping the device but the device can't ping me.

I'm pinging IP addresses not host names

the 2 subnets in question are these: xxx.xxx.30.8 - 255.255.255.248 and xxx.xxx.20.17 - 255.255.255.240

the routing is managed by others but everything on the network works well

Seems a library issues, may be from the original ping.h? I can't find nothing.

tnx

DavideTurra commented 1 year ago

I've seen that it's not that I can't ping hosts outside my subnet but that regardless of the host's position on the network, ping works on some hosts and doesn't on others. By a fatality all the hosts I had tried on the other subnet were unresponsive and those on my subnet did. I have now tried with other hosts and noticed this behavior. It seems that ping works on some hosts and not on others.

shmoun commented 1 year ago

It would be interesting to get a packet capture on the gateway. Comparing successful pings and replies <-> hosts on the other subnet to unsuccessful pings. What is going on? Does the gateway do NAT? Are there firewall rules defined for FORWARDING?