feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

IPv6 support

Open l9i opened this issue 4 years ago • 44 comments

Describe the problem you have/What new integration you would like ESPHome should be usable (== addressable) on an IPv6-only network.

Please describe your use case for this integration and alternatives you've tried: My HomeAssistant instance used to live on an IPv6-only network until it needed to communicate with an ESPHome node.

Additional context Based on my cursory look, ESP-IDF supports IPv6 with SLAAC.

l9i avatar May 03 '20 20:05 l9i

Looks like there is already work on mDNS-IPv6 in the arduino core: https://github.com/esp8266/Arduino/pull/7335

Unfortunately enabling IPv6 in lwIP currently breaks ESPAsyncTCP: https://github.com/me-no-dev/ESPAsyncTCP/issues/148

valpackett avatar Jun 24 '20 22:06 valpackett

Is there any progress on this?

ski7777 avatar Nov 15 '20 21:11 ski7777

Still nothing? Have anyone at least started porting this to IPv6-enabled LWIP?

I am looking for any examples (from forks of this or any other entirely different projects) so I can understand how calls to dual-stack IPAddress structs should look like and how should any interface deal with it, so I/we can start at least some hacky working draft for this...

Does anyone know of any good one?

leonelsr avatar Jan 11 '21 19:01 leonelsr

What is the status of the IPv6 support? If I implement a new device architecture, I have to be sure that it is future proof.

RHAD1969 avatar Mar 22 '21 21:03 RHAD1969

Enabling IPv6 in lwIP still breaks ESPAsyncTCP, and the issue was unfortunately closed because no one was working on it: me-no-dev/ESPAsyncTCP#148.

That project seems dead - no commits since 2019, and eight pull requests collecting dust.

In any case, it's a problem to be fixed there, and not in esphome. Maybe @me-no-dev can comment? If espressif doesn't intend to invest in ESPAsyncTCP anymore, maybe volunteer maintainers can step in, or the project can be forked?

grischard avatar Mar 22 '21 23:03 grischard

If possible, I also expect esphome to support IPv6 protocol stack, and I think this is the trend in the future

jack9603301 avatar Aug 03 '21 19:08 jack9603301

v6 is the future and will also make many things easier e.g. static-ips without dhcp (faster link-local-addresses)

Ruakij avatar Aug 15 '21 09:08 Ruakij

Matter (formerly Project CHIP) Application Layer support requirements might be very strong argument why IPv6 support is needed.

Created separate feature request discussion for Matter/CHIP Application Layer support in https://github.com/esphome/feature-requests/issues/1430 but looks like IPv6 is required now.

Hedda avatar Sep 23 '21 12:09 Hedda

hmm, do these documents from ESP-IDF Programming guide for ESP32 v4.3.1 make it sound like IPv6 is supported on ESP32?

https://docs.espressif.com/projects/esp-idf/en/v4.3.1/esp32/api-guides/lwip.html?highlight=ipv6

ESP-IDF version of lwIP (esp-lwip) list IPv6 support under FEATURES:

https://github.com/espressif/esp-lwip/blob/2.1.2-esp/README

  • IP (Internet Protocol, IPv4 and IPv6) including packet forwarding over multiple network interfaces

https://github.com/espressif/esp-lwip

Hedda avatar Sep 23 '21 12:09 Hedda

The blocker here is IPv6 support on the esp8266. It would be unfortunate if esphome only supported ipv6 on the esp32.

grischard avatar Sep 23 '21 12:09 grischard

The blocker here is IPv6 support on the esp8266. It would be unfortunate if esphome only supported ipv6 on the esp32.

OK then that is understandable. Espressif and the Matter/CHIP only support Matter/CHIP Application Layer on ESP32 anyway.

Hedda avatar Sep 23 '21 12:09 Hedda

I looked a bit into this, and created an updated ESPAsyncTCP that works with IPv6, https://github.com/HeMan/ESPAsyncTCP/tree/ipv6 and I have a local version of https://github.com/HeMan/esphome/tree/ipv6 that could at least start web_server on an ESP8266. It seems that the Arduino for ESP32 doesn't have IPv6 support, but I'll try to get it to work with esp-idf.

HeMan avatar Dec 22 '21 06:12 HeMan

ESPHome 2022.2.0 was released with IPv6 support for esp-idf framework, https://esphome.io/changelog/2022.2.0.html#new-features

HeMan avatar Feb 20 '22 15:02 HeMan

Note that the esp-idf framework doesn't support some components (yet), for example the web server or the captive portal.

grischard avatar Feb 21 '22 06:02 grischard

@nagyrobi can we really consider this as completed as it is only available with ESP-IDF which still not support all component and is only for ESP32?

Nardol avatar Jul 01 '22 08:07 Nardol

AFAIK the long-term goal is to move everyting to ESP-IDF. And indeed you're riht, ESP-IDF platform is still missing Ethernet support in ESPHome, so actually things depend on each other. However, I think the first big step has been done, ice broken - with compromises but yes, can be used.

nagyrobi avatar Jul 01 '22 08:07 nagyrobi

And what about ESP8266? I thought ESP-IDF was only for ESP32, which is the case in ESPHome.

About not supported components I was referring for example to captive portal which is still not compatible with ESP-IDF, because of web server which is not yet compatible if I am not wrong. But I suppose in long term it will be compatible...

Nardol avatar Jul 01 '22 09:07 Nardol

Also I cannot compile esp-idf on Raspberry PI4

wtremmel avatar Jul 01 '22 09:07 wtremmel

I have a working IPv6 implementation for ESP8266 that needs some work. Some of the components doesn't support IPv6, and I have a created a PR to solve one (https://github.com/OttoWinter/ESPAsyncTCP/pull/4). IPv6 on the Arduino version for ESP32 needs a newer Arduino than what Platform.io had when I last looked into it, but that could have changed now.

HeMan avatar Jul 01 '22 09:07 HeMan

Tasmota has gained great success in implementing IPv6 for ESP32 and ESP8266. Details can be found in the related issue https://github.com/arendst/Tasmota/issues/2521 and their release notes https://github.com/arendst/Tasmota/releases/tag/v12.4.0. Maybe their implementation is helpful or even compatible to reuse in esphome.

MaZe3D avatar Feb 26 '23 20:02 MaZe3D

Finally got some time to work on IPv6 support and have created two PRs, https://github.com/esphome/esphome/pull/4750 and https://github.com/esphome/esphome/pull/4759. The second one needs ~~https://github.com/OttoWinter/ESPAsyncTCP/pull/4~~ https://github.com/esphome/ESPAsyncTCP/pull/1 to be merged before it compiles. Next step is to enable it for Ethernet as well. RP2040 is unfortunately a lot harder to get working with IPv6.

HeMan avatar Apr 29 '23 08:04 HeMan

Got IPv6 to work with Ethernet as well, https://github.com/esphome/esphome/pull/4807

HeMan avatar May 11 '23 21:05 HeMan

Originally posted by @HeMan in https://github.com/esphome/esphome/issues/4807#issuecomment-1544766968

This just adds dynamic IPv6 via SLAAC or DHCPv6, in par with IPv6 for ESP-IDF (https://github.com/esphome/esphome/pull/2953). Adding static addresses needs a bigger internal change that starts with https://github.com/esphome/esphome/pull/4729.

Off-topic but an indirectly related question; dynamic IPv6 addresses should be compatible with Matter standard/protocol, right?

Question is related to this other ESPHome feature request for Matter standard/protocol support -> https://github.com/esphome/feature-requests/issues/1430

As I understand the core Matter protocol should in theory be able to communicate over any type of IPv6 transport and network.

Hedda avatar May 12 '23 06:05 Hedda

Off-topic but an indirectly related question; dynamic IPv6 addresses should be compatible with Matter standard/protocol, right?

Question is related to this other ESPHome feature request for Matter standard/protocol support -> #1430

As I understand the core Matter protocol should in theory be able to communicate over any type of IPv6 transport and network.

I think so. Dynamic addressing, especially on IPv6, is a more convenient way to maintain a network. Static addresses have it uses so I'm still going to implement it, but I think the main part is going to use dynamic addresses.

HeMan avatar May 12 '23 06:05 HeMan

Keep in mind there are two kind of dynamic address assignment in IPv6: SLAAC and DHCPv6. For IoT devices, address assignment via DHCPv6 might not be necessary (Android devices for example also cannot use DHCPv6 to get an IPv6 address).

If you want to read up about IPv6, there is a nice public book here on Github: https://github.com/becarpenter/book6

wtremmel avatar May 12 '23 08:05 wtremmel

I now have basic IPv6 working on all platforms and have started to rewrite the internals to be more address agnostic. It also need to understand that it could have multiple addresses, since IPv6 could have a few and also since it will be dual stack it could have one IPv4 address. DNS-resolving for MQTT for example need to look for both A- and AAAA-records, and happy eyeballs should perhaps be implemented as well.

HeMan avatar Aug 24 '23 05:08 HeMan

I just enabled IPv6 on one of my sensors - but debug output did not show any IPv6 addresses being assigned. Checking my firewalls NDP table I only see a link-local address for this device. Do I need to enable any additional debug to see IPv6 related messages?

wtremmel avatar Aug 24 '23 07:08 wtremmel

I just enabled IPv6 on one of my sensors - but debug output did not show any IPv6 addresses being assigned. Checking my firewalls NDP table I only see a link-local address for this device. Do I need to enable any additional debug to see IPv6 related messages?

Could you please open a issue with information about hardware and the important parts of your yaml.

HeMan avatar Aug 24 '23 07:08 HeMan

Yey, PR for enabling IPv6 on ESP8266 and RP2040 (Raspberry Pi Pico) was merged yesterday! 🥳

HeMan avatar Sep 13 '23 06:09 HeMan

I think this could be close after https://github.com/esphome/esphome/pull/5449 is merged. Could you people test it when it gets merged or from my branch now?

HeMan avatar Feb 23 '24 07:02 HeMan