Get IPv6 gateway address with ESP32

How can I get the gateway's (router's) IPv6 address with ESP32 STATtion?
Thank you.

Check the API, I imagine there is a function to do that.

Here is how to get it in old style, I have no idea how in V6

WiFi.gatewayIP();

Try this


  // Print IPv6 addresses
  if (WiFi.enableIpV6()) {
    Serial.println("IPv6 enabled!");

    // Local IPv6 address
    Serial.print("Local IPv6: ");
    Serial.println(WiFi.localIPv6());

    // Gateway IPv6 address (not available directly in Arduino, but can be retrieved using custom libraries/tools if network supports it)
    Serial.print("Gateway IPv6: ");
    Serial.println("Check router or custom libraries for gateway info.");
  } else {
    Serial.println("Failed to enable IPv6.");
  }

Thank you for answering. This works for IPv4 but not for IPv6. Lwip has a built-in option to do this but not all lwpi files are available in Arduino.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.