Hello everyone,
I am working on a project involving the ESP32 and I need to enable IPv6 connectivity. I have configured my ESP32 to connect to a Wi-Fi network, and I have successfully obtained both IPv4 and IPv6 addresses. However, I am facing challenges with certain aspects and need some guidance.
Steps Taken:
Configured Wi-Fi: Set up my Wi-Fi connection using the standard initialization procedures.
Event Handling: Implemented event handlers to capture IP_EVENT_STA_GOT_IP and IP_EVENT_GOT_IP6 events to obtain IPv4 and IPv6 addresses.
Socket Connections: Attempted to create and connect sockets using both IPv4 and IPv6 addresses based on their availability.
Issues and Queries:
Dependencies: Are there any specific dependencies or configurations I need to ensure are in place for IPv6 to work correctly on the ESP32?
Best Practices: What are the best practices for managing and using IPv6 addresses in an ESP32 application?
Troubleshooting: If there are common issues or troubleshooting steps I should be aware of, please let me know.
Additional Features: Are there any additional features or configurations (like DHCPv6, SLAAC) that I should consider enabling to enhance IPv6 support?
Any help or pointers would be greatly appreciated. Thanks in advance!
Mustaqim
Assistance with Using IPv6 on ESP32
Re: Assistance with Using IPv6 on ESP32
There you have a very good point. Documentation is really missing here. There are some things I still don't understand, but both Espressif nor the guys at LWIP are willing to explain. Having said that, I have it working so I might be able to help.
You may get away using just a static address. You would need to set the netmask and the default gateway. Both the ESP-IDF and LWIP API do not allow you to set these. So I fear this only works on L2 networks (no routing). Apply idf.py
menuconfig and check all relevant options for ipv6 under components - lwip.
Best practice is to use SLAAC. Using the RA packets your router is sending (this is required, if your router can't send them, it's not going to work) LWIP can learn the gateway and the netmask. Only drawback is you can't choose the IP address. It will be your prefix and the mac appended to it (basically...).
You can use both at the same time. Make sure to enable 3 ipv6 addresses per interface.
You may get away using just a static address. You would need to set the netmask and the default gateway. Both the ESP-IDF and LWIP API do not allow you to set these. So I fear this only works on L2 networks (no routing). Apply idf.py
menuconfig and check all relevant options for ipv6 under components - lwip.
Best practice is to use SLAAC. Using the RA packets your router is sending (this is required, if your router can't send them, it's not going to work) LWIP can learn the gateway and the netmask. Only drawback is you can't choose the IP address. It will be your prefix and the mac appended to it (basically...).
You can use both at the same time. Make sure to enable 3 ipv6 addresses per interface.
-
- Posts: 2
- Joined: Fri Jul 19, 2024 12:21 pm
Re: Assistance with Using IPv6 on ESP32
Thanks eriksl for your help, ive got the ipv6 working in DHCP. After i get the event for IPv4(ip address assigned from the router) i have to call this function while enabling the ipv6 settings in sdkconfig.
esp_netif_t *my_sta = NULL;
if (my_sta != NULL) {
esp_err_t err = esp_netif_create_ip6_linklocal(my_sta);
if (err != ESP_OK) {
ESP_LOGE(WIFI_TAG, "Failed to create IPv6 link-local address on start: %s", esp_err_to_name(err));
}
} else {
ESP_LOGE(WIFI_TAG, "my_sta is NULL on start");
}
Now i am working with the Nuvoton M4 microcontroller and LWIP stack and want to get it working on IPv6
esp_netif_t *my_sta = NULL;
if (my_sta != NULL) {
esp_err_t err = esp_netif_create_ip6_linklocal(my_sta);
if (err != ESP_OK) {
ESP_LOGE(WIFI_TAG, "Failed to create IPv6 link-local address on start: %s", esp_err_to_name(err));
}
} else {
ESP_LOGE(WIFI_TAG, "my_sta is NULL on start");
}
Now i am working with the Nuvoton M4 microcontroller and LWIP stack and want to get it working on IPv6
Re: Assistance with Using IPv6 on ESP32
Yes, this is in the documentation. Only after the link local address is set, SLAAC (no DHCP) will start. DHCPv6 is not supported for address assignment, only for additional data like DNS servers. I think SLAAC will be the best option for you, but ensure ipv6 router advertisements are sent by your router, including a prefix to be used. The prefix needs to be /64 bits wide for SLAAC to work.
Who is online
Users browsing this forum: Esp_Noobe_Sag and 95 guests