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

Can't make EMQX listen to both IPv4 and IPv6 on the same port #126

Open
bjanders opened this issue Dec 27, 2024 · 1 comment
Open

Can't make EMQX listen to both IPv4 and IPv6 on the same port #126

bjanders opened this issue Dec 27, 2024 · 1 comment

Comments

@bjanders
Copy link

Problem/Motivation

I'm trying to make the EMQX addon to listen to both IPv4 and IPV6 on port 1883. The default settings listen to IPv4 0.0.0.0:1883. In the EMQX web UI in Cluster Settings -> Listeners, I tried to add a new listener for '[::]:1883', but get the error

400 BAD_REQUEST: {failed_to_start,"tcp:IPv6([::]:1883) : {shutdown,{failed_to_start_child,listener,eaddrinuse}}"}

("IPv6" in the message above is the name of listener I created.)

I can replace '0.0.0.0:1883' with '[::]:1883' but then I don't have IPv4.

When configuring the EMQX config file directly, I believe you can set:

listeners.tcp.default {
    bind = "0.0.0.0:1883"
    bind = "[::]:1883"
}

But AFAIK I cannot edit the config file directly in Home Assistant.

Expected behavior

I should be able to add an IPv6 listener on port 1883 along with the IPv4 listener on the same port.

Actual behavior

I get the error:

400 BAD_REQUEST: {failed_to_start,"tcp:IPv6([::]:1883) : {shutdown,{failed_to_start_child,listener,eaddrinuse}}"}

Steps to reproduce

  • Go to Cluster Settings -> Listeners, click "Add Listener" and add a lister for "[::]:1883"
  • An error is displayed, and the listener is not added.

Proposed changes

Probably an issue in the upstream web UI, and should be fixed there.

This add-on could provide direct access to the config file, or then the default config should listen to IPv6 as well.

@bjanders
Copy link
Author

I also tried to set

env_vars:
  - name: EMQX_LISTENERS__TCP__IPV6__BIND 
    value: "[::]:1883"

but it logs:

 tcp:ipv6 failed to listen on 1883 - eaddrinuse (address already in use)

Then when I try to remove env_vars in the add-on configuration, I get the error:

Failed to save add-on configuration, Invalid list for option 'env_vars' in EMQX (a0d7b954_emqx). Got {'env_vars': {}}

which is another issue.

Btw, the link to https://www.emqx.io/docs/en/v5.0/admin/cfg.html in https://github.com/hassio-addons/addon-emqx/blob/main/emqx/DOCS.md does not work. I found the documentation here: https://docs.emqx.com/en/emqx/latest/configuration/configuration.html#environment-variables

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

No branches or pull requests

1 participant