0

Update 2: Have tested by pinging various devices on different subnets / vlans and did a pcap on the wifi AP
I can see the icmp requests going through for each request except for ones on the 4.x subnet, almost like the arduino doesnt like that IP address and refuses to send those packets?

Update 1:

Have tested the following

Turned on logging on firewall and noticed the following actions:

  • Ping router from Arduino - See logs in firewall, arduino gets response. (Red line)
  • Send external web request from arduino - See logs in firewall, arduino gets response. (Orange Line)
  • Send web request to internal server - Arduino queries internal DNS and gets IP of web server, but no request send (Nothing in firewall logs) (Yellow and Blue)
  • Send ping to internal server - Arduino queries same dns server, gets ip, but no request sent (Firewall logs again) (Yellow and Green)

however, sending the ping and web request from desktop, shows both the firewall log blocking the ping request, and the rule allowing the web request.(Brown Purple Pink)

Have attached diagram again to help visualize whats going onAnd can attach router logs or rules if required

https://imgur.com/a/g4TipmZ

Also have set a windows PC with the same IP address, and can ping the web server, so I know it's something wrong with the arduino's requests to the web server in particular, and not the firewall?

End Update

I have two Node MCUs which I'm using for a project. A while ago they were working fine, but i recently changed some network settings on my home network and found that it broke the script I had running on them. I finally figured out where it went wrong and fixed it, but now I have another interesting problem.

One of my nodes runs this script fine, where as the other gets stuck on the ping stage. I have uploaded the same script to both nodes and swapped over the IP address assigned and it follows the device not the IP. So I know its not a networking issue.

I know the WiFi is working on the funny node, as it gets a IP address. but it doesn't go any further

Any ideas?

Script attached below:

    #include <DHT.h>
    #include <ESP8266WiFi.h>
    #include <ESP8266HTTPClient.h>
    #include <ESP8266Ping.h>

    // WiFi credentials.
    const char* WIFI_SSID = "SSID";
    const char* WIFI_PASS = "******";
    WiFiClientSecure wifiClient;
    bool connection = false;
    WiFiClient client;
    const char* dbServer = "webaddress";

    void setup() {
      //Open Serial
      Serial.begin(9600);
      Serial.setTimeout(2000);

    //Connect to Wifi
      bool pingtest = false;
      Serial.print("Connecting to WiFi");
      WiFi.begin(WIFI_SSID, WIFI_PASS);
      //Wait for connection
      int wificount = 0;
      while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
      }
      if (WiFi.status() == WL_CONNECTED) {
        connection = true;
        Serial.println("WiFi connected");
        Serial.println("IP address: ");
        Serial.println(WiFi.localIP());
        while(!pingtest){
          Serial.println("Pinging Server");
          if(Ping.ping(dbServer) == true){
            pingtest = true;
          }else{
            Serial.print(".");
            delay(1000);
          }
        } 
      }


    }

void loop() {
  Serial.println("Hello");
  delay(2000);
}

Update (Cross posted from another forum): I have an Arduino which pings a server on a different VLAN / subnet as part of its code. It was working a while ago, but I changed some settings on my firewall to restrict stuff down, and that broke the Arduino code. I found it was because I was blocking ICMP across VLANs. So I created a rule to allow ping requests between the two VLANs tested on my desktop (on same net as Arduino) and works fine. Went to test on Arduino and wasn't getting any response.

So I put the router IP in and tested it on the Arduino, works fine. I can even ping the Arduino from my desktop, and ping my desktop from the Arduino

So I figured I must have some other firewall rule allowing my desktop to have special access. (not that I could find it) so gave the arduino the same Ip address and no luck, yet can still ping the router

I have attached a crude drawing here. Hopefully it helps to visualize my problem.

enter image description here

  • try to erase the flash memory with esptool to clear old RF settings, then upload the sketch and wait a couple of minutes until RF settings calibrate – Juraj Feb 10 at 8:27
  • That didn't work Erased the flash on both devices and now they are both failing to ping, or to do my web request later in the code. – Thomas PomTom Steel Feb 11 at 6:14
  • ok, not sure if its a routing issue or a arduino issue as im getting some odd test results. Will update original posting with new findings – Thomas PomTom Steel Feb 11 at 7:37
  • did you let it time to calibrate the RF part? – Juraj Feb 11 at 10:32
  • Yes, have updated the original posting with more information – Thomas PomTom Steel Feb 11 at 19:01
0

If a ping doesn't work over a routed connection it could be.

  1. Default gateway on the Arduino device, add a Serial.println(WiFi.gatewayIP().toString()); to print the default gateway.

  2. DNS issue, I presume that the const char* dbServer = "webaddress"; indicate a FQDN.

  3. Firewall is blocking the ICMP on either the inbound or outbound path.

  • Have done alot of testing on another forum, and have come to the conclusion its the arduino not wanting to send requests to a very specific IP range. For testing I have the following setup Desktop PC: 192.168.1.100, arduino 192.168.1.222 (Vlan 10) Server 1: 192.168.99.40 (Vlan 99) Server 2: 192.168.4.200 (Vlan 40) I can ping both servers fine from my desktop pc. I can ping google, the router, and server 1 from the arduino, but not server 2. I did a packet capture on the WiFi access point, and can see the ICMP packets for the other pings going though, but not when pinging server 2 – Thomas PomTom Steel Feb 12 at 22:54
  • I have also set a laptop to have the same IP address as the arduino (After turning the arduino off to avoid conflicts) and the ping goes though fine. I have also confirmed that the gateway ip and netmask are set correctly on the arduino. and I have removed any domains from the scripts for testing, using just IP addresses to try remove DNS issues – Thomas PomTom Steel Feb 12 at 22:56
  • Add a sniffer to vlan 10 and have a look at whet the Arduino is sending. And check what the firewall log is saying/blocking. – MatsK Feb 13 at 1:06
  • Not to come across as rude. Just I have already mentioned this twice. Did a pcap on the wifi AP and dont see any requests from the arduino when pinging the 4.x range, but i do with the other ping requests. And the firewall shows the same, logs for all my ping tests except 4.x range – Thomas PomTom Steel Feb 13 at 2:16

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.