Skip to content

I am working(Actually trying) to connect ESP32 or ESP8266 with my IPv6 router. This repo is made to update my work. I'm sharing this repo where I have to update status of my work, I am open to modify this document from anyone. And I am open to collaborate on this until the project works successfully.

Notifications You must be signed in to change notification settings

my-dudhwala/ESP_IPv6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 

Repository files navigation

ESP_IPv6

"If you come across any errors or omissions in this document, please feel free to make updates or changes, and don't hesitate to restructure the content as needed."

"I am actively working to establish a connection between ESP32 or ESP8266 and my IPv6 router. This repository serves as a platform to continuously update the progress of my work and maintain comprehensive documentation of the entire process. I welcome contributions and collaboration from anyone interested in helping to make this project a success. Additionally, the knowledge and insights gained from this project can be valuable to anyone seeking to work with similar setups."

Important Updates

"I'm utilizing IDF version 4.4.5 to test certain code because some of the IPv6 code and menuconfig options are compatible with this version, and they work without any issues."

Code-related Updates

"According to IDF documents, 'Enable IPv4 stack. If you want to use IPv6 only TCP/IP stack, disable this.' However, it seems that pressing the enter button does not uncheck the option, as expected."

Several Updates

21/09/2023

Reddit

  1. IPv6 Community - Does anyone have connected Microcontroller (ESP) to IPv6 internet?
  2. Arduino Community - How to connect ESP32 to WiFi with IPv6 configuration?
  3. Arduino Community - Is it possible to connect ESP32 with IPv6 internet?

GitHub

  1. EspDDNS_with_IDF - GitHub
Error in Different Code

Inbuilt example Code: Espressif\frameworks\esp-idf-v4.4.5\examples\protocols\http_request
On GitHub

Error: socket connect failed errno=113

Serial Output:

I (4966) esp_netif_handlers: example_connect: sta ip: 192.168.0.236, mask: 255.255.255.0, gw: 192.168.0.254
I (4967) example_connect: Got IPv4 event: Interface "example_connect: sta" address: 192.168.0.236
I (5550) example_connect: Got IPv6 event: Interface "example_connect: sta" address: fe80:0000:0000:0000:96e6:86ff:fe05:0dd0, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (7549) example_connect: Got IPv6 event: Interface "example_connect: sta" address: 2002:c0a8:00fe:0001:96e6:86ff:fe05:0dd0, type: ESP_IP6_ADDR_IS_GLOBAL
I (7554) example_connect: Got IPv6 event: Interface "example_connect: sta" address: 2002:c0a8:0165:0001:96e6:86ff:fe05:0dd0, type: ESP_IP6_ADDR_IS_GLOBAL
I (7568) example_connect: Connected to example_connect: sta
I (7574) example_connect: - IPv4 address: 192.168.0.236
I (7580) example_connect: - IPv6 address: fe80:0000:0000:0000:96e6:86ff:fe05:0dd0, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (7591) example_connect: - IPv6 address: 2002:c0a8:00fe:0001:96e6:86ff:fe05:0dd0, type: ESP_IP6_ADDR_IS_GLOBAL
I (7602) example_connect: - IPv6 address: 2002:c0a8:0165:0001:96e6:86ff:fe05:0dd0, type: ESP_IP6_ADDR_IS_GLOBAL
I (7627) example: DNS lookup succeeded. IP=93.184.216.34
I (7628) example: ... allocated socket
I (8885) wifi:<ba-add>idx:1 (ifx:0, b0:be:76:59:c5:02), tid:6, ssn:2, winSize:64
E (25890) example: ... socket connect failed errno=113
I (29891) example: DNS lookup succeeded. IP=93.184.216.34
I (29892) example: ... allocated socket
E (48405) example: ... socket connect failed errno=113
I (52406) example: DNS lookup succeeded. IP=93.184.216.34
I (52407) example: ... allocated socket
20/09/2023
  • esp_http_client (Built-in example)

    IDF 4.4.5 Errors: E (13733) esp-tls: [sock=54] select() timeout E (13734) TRANSPORT_BASE: Failed to open a new connection: 32774 E (13735) HTTP_CLIENT: Connection failed, sock < 0 E (13740) HTTP_CLIENT: HTTP GET request failed: ESP_ERR_HTTP_CONNECT

Menuconfig: Every Setting About IPv6 - 20/09/2023

Note: I've conducted thorough research on IPv6 menuconfig options within the IDF, and you can find the details in the IDF article (link provided below). If you're unfamiliar with menuconfig, it's likely that you're not working with IDF. In IDF, there's an extensive GUI setting that allows for automatic configuration of ESP code. For those using IDF and looking to explore menuconfig, simply enter idf.py menuconfig in the command prompt (Windows), and you'll quickly familiarize yourself with it on your ESP IDF journey. I apologize if you're not using the command-line interface (CLI), but it's generally faster than using VS Code. Personally, I prefer to use VS Code solely for code editing. Thanks for your understanding..

ESP IDF menuconfig

Every setting containing "IP6" word in the main title is given below, as of 20/09/2023:

CONFIG_LWIP_IP6_FRAG Enable fragment outgoing IP6 packets

Found in: Component config > LWIP

Enabling this option allows fragmenting outgoing IP6 packets if their size exceeds MTU.

Default value: Yes (enabled)

CONFIG_LWIP_IP6_REASSEMBLY Enable reassembly of incoming fragmented IP6 packets

Found in: Component config > LWIP

Enabling this option allows reassembly of incoming fragmented IP6 packets.

Default value: No (disabled)

CONFIG_LWIP_HOOK_IP6_INPUT IPv6 packet input

Found in: Component config > LWIP > Hooks

Enables custom IPv6 packet input. Setting this to "default" provides a weak implementation stub that could be overwritten in application code. Setting this to "custom" provides the hook's declaration only and expects the application to implement it.

Available options:

  • No hook declared (LWIP_HOOK_IP6_INPUT_NONE)
  • Default (weak) implementation (LWIP_HOOK_IP6_INPUT_DEFAULT)

Custom implementation (LWIP_HOOK_IP6_INPUT_CUSTOM)

CONFIG_LWIP_HOOK_IP6_ROUTE IPv6 route Hook

Found in: Component config > LWIP > Hooks

Enables custom IPv6 route hook. Setting this to "default" provides a weak implementation stub that could be overwritten in application code. Setting this to "custom" provides the hook's declaration only and expects the application to implement it.

Available options:

  • No hook declared (LWIP_HOOK_IP6_ROUTE_NONE)
  • Default (weak) implementation (LWIP_HOOK_IP6_ROUTE_DEFAULT)
  • Custom implementation (LWIP_HOOK_IP6_ROUTE_CUSTOM)

CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR IPv6 source address selection Hook

Found in: Component config > LWIP > Hooks

Enables custom IPv6 source address selection. Setting this to "default" provides a weak implementation stub that could be overwritten in application code. Setting this to "custom" provides the hook's declaration only and expects the application to implement it.

Available options:

  • No hook declared (LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE)
  • Default (weak) implementation (LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT)
  • Custom implementation (LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM)

CONFIG_LWIP_IP6_DEBUG Enable IP6 debug messages

Found in: Component config > LWIP > CONFIG_LWIP_DEBUG

Default value: No (disabled) if CONFIG_LWIP_DEBUG

Every setting containing "IPv6" word in the main title is given below, as of 20/09/2023:

CONFIG_LWIP_IPV6_DHCP6 Enable DHCPv6 stateless address autoconfiguration

Found in: Component config > LWIP

Enable DHCPv6 for IPv6 stateless address autoconfiguration. Note that the dhcpv6 client has to be started using dhcp6_enable_stateless(netif);. Note that stateful address autoconfiguration is not supported.

Default value: No (disabled) if CONFIG_LWIP_IPV6_AUTOCONFIG

CONFIG_LWIP_IPV6 Enable IPv6

Found in: Component config > LWIP

Enable IPv6 function. If not using IPv6 function, set this option to n. If disabling LWIP_IPV6, then some other components (coap and asio) will no longer be available.

Default value: Yes (enabled)

CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS Max number of entries in IPv6 neighbor cache

Found in: Component config > LWIP

Config max number of entries in IPv6 neighbor cache.

Range: from 3 to 10

Default value: 5

More about Neighbor Discovery

CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE Max number of IPv6 packets to queue during MAC resolution

Found in: Component config > LWIP

Config max number of IPv6 packets to queue during MAC resolution.

Range: from 3 to 20

Default value: 3

CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS Use IPv6 Router Advertisement Recursive DNS Server Option

Found in: Component config > LWIP

Use IPv6 Router Advertisement Recursive DNS Server Option (as per RFC 6106) to copy a defined maximum number of DNS servers to the DNS module. Set this option to a number of desired DNS servers advertised in the RA protocol. This feature is disabled when set to 0.

Default value: 0 if CONFIG_LWIP_IPV6_AUTOCONFIG

CONFIG_LWIP_ND6 LWIP NDP6 Enable/Disable

Found in: Component config > LWIP

This option is used to disable the Network Discovery Protocol (NDP) if it is not required. Please use this option with caution, as the NDP is essential for IPv6 functionality within a local network.

Default value: Yes (enabled)

Initial and Old Updates

These updates were initially posted on Reddit, now their copy is placed below.

Problem Statement: I am using a generic ESP32 module with ESP Wroom 32 chip. I am trying to connect it with a WiFi router with IPv6 configuration as the router is IPv6 only. I have spent hours working on it, I have tried many codes from GitHub, ChatGPT, and many other articles. Please guide me regarding this, and take me as a beginner. Thank you.

Update 1:

After searching a little, I found that the "Station" example, inside WiFi>Getting Started directory. And I'm getting 7 identifier errors. Thank you for your response; I am willing to step further as per your instructions. Please take me as a beginner. A warm thank you.

Edit: I am using Visual Studio Code with PlatformIO, and I have recognized that this functionality is not available in the Arduino framework. This is also a reason to use IDF.

Update 2:

The code uploaded successfully. Previously it was showing errors in VS Code.

Update 3:

Managed to compile and upload the code with IDF 4.4.5 in 2-3 days, got printed global and local IPv6, but not sure if it will work to connect with the internet or not. I will try to update if I remember. Thanks for giving me hope.

Update 4:

(This is a copied comment from a new Reddit and IDF post) Getting the above error in IDF while compiling code, which is a merged code. I have merged 2 codes, one is IPv6 from a git repo (Link is given below) and the second code is ESP32 with Google Sheets (Link is attached). Help please, and I am not sure that the IPv6 code is working correctly or not, but I have managed to get serial output. Take me as a very beginner in IDF. Thank you.

Reddit post

GitHub for IPv6: https://github.com/amitesh-singh/EspDDNS_with_IDF

ESP32 and Google Sheet automation: https://iotdesignpro.com/articles/esp32-data-logging-to-google-sheets-with-google-scripts

From here, I am updating everything on a different document. I will release it somewhere if need be.

_Future updates: I am placing all of my updates on my GitHub repo, link is given below

,_

https://github.com/my-dudhwala/ESP_IPv6/

About

I am working(Actually trying) to connect ESP32 or ESP8266 with my IPv6 router. This repo is made to update my work. I'm sharing this repo where I have to update status of my work, I am open to modify this document from anyone. And I am open to collaborate on this until the project works successfully.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages