-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Incorrect description of -bind default #1079
Comments
I ran into this issue just a few days ago, it binds to 127.0.0.1 by default and when I use 0.0.0.0 it still binds to just 127.0.0.1. I had to explicitly specify the IP address of eth0 as the bind_address. |
@bhourigan do you mean it was advertising 127.0.0.1, or that it was actually just binding to 127.0.0.1 when you specified 0.0.0.0? |
@aidanhs It was binding to 127.0.0.1. I didn't get to see what address it wanted to advertise. |
Looking at the code and doing a quick local test it looks like it'll advertise the private IP but bind to all interfaces - I'll take a deeper look at this one. |
To be clear, I think this behavior is fine and the documentation could just be a bit clearer. Maybe something like "By default, this is "0.0.0.0", meaning Consul will bind to all available IP address but only advertise the first available private IP address. To change the address that is advertised use --adverise option." |
I think the intent was not to bind to 0.0.0.0 by default, and the docs lead people to believe this isn't happening, so I think we'll change the behavior to be in line with the docs. |
Is "private IP address" a widely understood term? I'm not clear on the logic involved in choosing an IP address based on those words. |
The docs should probably be made more specific and reference RFC 1918 and RFC 6598 which specify the IP ranges that Consul looks for. We can also mention that this isn't a security mechanism, just a default behavior that tries to avoid binding to external interfaces. |
This will get cleaned up when we move to https://github.com/hashicorp/go-sockaddr and update the documentation around that. |
This issue is fixed in the docs now:
|
The documentation for the
-bind
default says:When reading this I found the following surprising:
Since 0.0.0.0 typically means "listen on all addresses" (i.e INADDR_ANY). A quick
lsof
on a consul process confirms that consul is listening on all interfaces:I'm guessing "Consul will use the first available private IP address" refers to the IP address that is advertised to other nodes in the cluster rather than what actually gets bound to.
The text was updated successfully, but these errors were encountered: