Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 support #718

Open
l9i opened this issue May 3, 2020 · 46 comments
Open

IPv6 support #718

l9i opened this issue May 3, 2020 · 46 comments

Comments

@l9i
Copy link

l9i commented May 3, 2020

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.

@valpackett
Copy link

Looks like there is already work on mDNS-IPv6 in the arduino core: esp8266/Arduino#7335

Unfortunately enabling IPv6 in lwIP currently breaks ESPAsyncTCP: me-no-dev/ESPAsyncTCP#148

@ski7777
Copy link

ski7777 commented Nov 15, 2020

Is there any progress on this?

@leonelsr
Copy link

leonelsr commented Jan 11, 2021

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?

@RHAD1969
Copy link

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.

@grischard
Copy link

grischard commented Mar 22, 2021

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?

@jack9603301
Copy link

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

@Ruakij
Copy link

Ruakij commented Aug 15, 2021

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

@Hedda
Copy link

Hedda commented Sep 23, 2021

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 #1430 but looks like IPv6 is required now.

@Hedda
Copy link

Hedda commented Sep 23, 2021

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

@grischard
Copy link

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

@Hedda
Copy link

Hedda commented Sep 23, 2021

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.

@HeMan
Copy link

HeMan commented Dec 22, 2021

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
Copy link

HeMan commented Feb 20, 2022

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

@grischard
Copy link

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

@rradar rradar added this to the Top Requested milestone Jun 30, 2022
@nagyrobi nagyrobi closed this as completed Jul 1, 2022
@Nardol
Copy link

Nardol commented Jul 1, 2022

@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?

@nagyrobi
Copy link
Member

nagyrobi commented Jul 1, 2022

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.

@Nardol
Copy link

Nardol commented Jul 1, 2022

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...

@wtremmel
Copy link

wtremmel commented Jul 1, 2022

Also I cannot compile esp-idf on Raspberry PI4

@nagyrobi nagyrobi reopened this Jul 1, 2022
@HeMan
Copy link

HeMan commented Jul 1, 2022

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 (OttoWinter/ESPAsyncTCP#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.

@MaZe3D
Copy link

MaZe3D commented Feb 26, 2023

Tasmota has gained great success in implementing IPv6 for ESP32 and ESP8266. Details can be found in the related issue arendst/Tasmota#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.

@HeMan
Copy link

HeMan commented Apr 29, 2023

Finally got some time to work on IPv6 support and have created two PRs, esphome/esphome#4750 and esphome/esphome#4759. The second one needs OttoWinter/ESPAsyncTCP#4 esphome/ESPAsyncTCP#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
Copy link

HeMan commented May 11, 2023

Got IPv6 to work with Ethernet as well, esphome/esphome#4807

@Hedda
Copy link

Hedda commented May 12, 2023

Originally posted by @HeMan in esphome/esphome#4807 (comment)

This just adds dynamic IPv6 via SLAAC or DHCPv6, in par with IPv6 for ESP-IDF (esphome/esphome#2953). Adding static addresses needs a bigger internal change that starts with esphome/esphome#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 -> #1430

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

@HeMan
Copy link

HeMan commented May 12, 2023

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.

@wtremmel
Copy link

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

@HeMan
Copy link

HeMan commented Aug 24, 2023

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.

@wtremmel
Copy link

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?

@HeMan
Copy link

HeMan commented Aug 24, 2023

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
Copy link

HeMan commented Sep 13, 2023

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

@HeMan
Copy link

HeMan commented Feb 23, 2024

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

@kquinsland
Copy link

kquinsland commented Feb 23, 2024

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

Thank you for all the work you've done on this! <3.

I was planning on taking some time this weekend to update all my devices now that 24.02 is out but I can try pulling in your branch.

The yaml should look like this:

external_components:
  - source: github://pr#5449
    components: [ wifi_info ]

Or does components need the full suite: ethernet, ethernet_info, mqtt, network, socket, wifi, wifi_info ?

@HeMan
Copy link

HeMan commented Feb 23, 2024

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

Thank you for all the work you've done on this! <3.

I was planning on taking some time this weekend to update all my devices now that 24.02 is out but I can try pulling in your branch.

The yaml should look like this:

external_components:
  - source: github://pr#5449
    components: [ wifi_info ]

Or does components need the full suite: ethernet, ethernet_info, mqtt, network, socket, wifi, wifi_info ?

You need to clone my repo and check out the branch. It can unfortunately not be used as an external component.

@HeMan
Copy link

HeMan commented Feb 27, 2024

It is now merged so you should be able to use the dev-branch.

@HeMan
Copy link

HeMan commented Mar 21, 2024

It's now released as part of 2024.3, https://esphome.io/changelog/2024.3.0.html#ipv6. There are some more things I'd like to add, like support for IPv6 only networks, but it should be usable in dual stack environments for now. Could you people test?

@wtremmel
Copy link

It did not work in one of my IPv6 only-networks. Kept disconnecting (like if it does not have an IPv4 address it did not consider itself connected).

Also (in a dual stack network) it does not add an IPv6 DNS address. (using RA only. No DHCPv6).

@HeMan
Copy link

HeMan commented Mar 21, 2024

It did not work in one of my IPv6 only-networks. Kept disconnecting (like if it does not have an IPv4 address it did not consider itself connected).

Yeah, that is expected since it still deserves IPv4 to consider started.

Also (in a dual stack network) it does not add an IPv6 DNS address. (using RA only. No DHCPv6).

Did you mean mDNS? Regular DNS could not be updated with SLAAC. And mDNS works best with esp-idf version 5.0.x or above unfortunately.

@wtremmel
Copy link

Did you mean mDNS? Regular DNS could not be updated with SLAAC.

Perhaps something worth working on. I really dream about getting rid of IPv4 completely for my internal networks...

@HeMan
Copy link

HeMan commented Mar 21, 2024

Did you mean mDNS? Regular DNS could not be updated with SLAAC.

Perhaps something worth working on. I really dream about getting rid of IPv4 completely for my internal networks...

mDNS could be worth working on. SLAAC does only send out information regarding the network, it doesn't get anything back, which means that it can't update a DNS. DHCPv6 could do that, but lwip doesn't support that part of DHCPv6.

@aaliddell
Copy link

Did you mean mDNS? Regular DNS could not be updated with SLAAC.

Perhaps something worth working on. I really dream about getting rid of IPv4 completely for my internal networks...

mDNS could be worth working on. SLAAC does only send out information regarding the network, it doesn't get anything back, which means that it can't update a DNS. DHCPv6 could do that, but lwip doesn't support that part of DHCPv6.

DNS is optionally present in the RA packets used for SLAAC: https://datatracker.ietf.org/doc/html/rfc8106

So when you receive RA required to do SLAAC, you could take the IPv6 DNS info if it is present without having to use DHCPv6.

@Nardol
Copy link

Nardol commented Mar 21, 2024

mDNS could be worth working on. SLAAC does only send out information regarding the network, it doesn't get anything back, which means that it can't update a DNS. DHCPv6 could do that, but lwip doesn't support that part of DHCPv6.

DNS is optionally present in the RA packets used for SLAAC: https://datatracker.ietf.org/doc/html/rfc8106

So when you receive RA required to do SLAAC, you could take the IPv6 DNS info if it is present without having to use DHCPv6.

Yes, named RDNSS if I am not confusing with something else.
I don't know if lwip supports it.

@HeMan
Copy link

HeMan commented Mar 21, 2024

RDNSS is to anounce which DNS server to use, not to update the DNS-server. RDNSS is supported by lwip.

@HeMan
Copy link

HeMan commented Mar 21, 2024

Oh, now I see what you mean! RDNSS do set the DNS server on the ESP, but it's not shown in the log. Just tried to remove my DNS setting in the DHCP server and just propagated it via SLAAC and resolving of addresses worked. Will try to figure out how to display it.

@Nardol
Copy link

Nardol commented Mar 21, 2024

For MDNS and ESP8266, does esphome/esphome#5359 change how IPv6 is supported?

@kquinsland
Copy link

Yeah, that is expected since it still deserves IPv4 to consider started.

Is there a list of $things in ESPHome that still rely on IPv4?

@HeMan
Copy link

HeMan commented Mar 22, 2024

ESPHome networking components (ethernet and wifi) needs an IPv4 address to assume a connection. I haven't looked at what other components that communicates over IP that still needs IPv4.

@Hedda
Copy link

Hedda commented May 31, 2024

There are some more things I'd like to add, like support for IPv6 only networks

I guess one future scenario for IPv6-only devices is how and when native support for OpenThread (Thread) is added to ESPHome?

"IThread is an Pv6-based networking protocol designed for low-power Internet of Things devices in an IEEE 802.15.4-2006 wireless mesh network, commonly called a Wireless Personal Area Network (WPAN). Thread is independent of other 802.15 mesh networking protocols"

FYI, that includes ESP32-H2 and ESP32-C6 (and newer SoCs), but note there is a separate feature request for OpenThread here:

PS: Off-topic but FYI, there is also an OpenThread proof-of-concept project for ESPHome discussed in community forum here:

https://community.home-assistant.io/t/announcement-esphome-running-on-adafruit-52840-over-thread-mesh-networking-using-zephyrrtos/363712

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests