-
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
Consul wan docs enhancement #1914
Comments
Hi @shakisha I'll leave this open as a reminder to improve the docs in this section. Here's some info that should help:
The port you'd want to use for the join is the "Serf WAN" port which defaults to 8302. You'd need the Consul servers participating in the WAN to expose this port bound to an interface that's reachable from the other Consul servers (they need to form a fully connected mesh). You'll need TCP and UDP access to this port from any firewalls.
The best way to do this is via the
The gossip part is the "Serf WAN" port discussed above. You'll also need to expose the "Server RPC" port 8300/tcp in order for RPC forwarding to work. All servers participating in the WAN should be able to reach each other on 8300/tcp. |
Hi James @slackpad , thank you really much for your answer;
This remote consul server has got in the configuration the bind address configured as lan. When i start consul on wan client i receive an error that the wan is available only in server mode.
Where i'm lost? in the documentation i cannot find nothing about this issue ;( |
Hello @slackpad , still not have got success on this :-( Have you got any kinda of update for me? Thank you a lot! |
Hi @shakisha I think it might be |
@slackpad : this is exactly the part of the docs which I didn't get. in datacenter "lon1" I have the configuration listed above and connection refuse error, but from tcpdump in pretty sure that lon1 server is contacting the server at "datacenter0". should I totally remove bind address and use https://www.consul.io/docs/agent/options.html#advertise_addrs or put only advertise wan address? will be secure keeping only that port with encryption enabled? UPDATE:i have tried putting these values in the configuration of datacenter0 and lon1:
but didn't worked, still the same "getsockopt: connection refused" (firewalls are disabled on both side). Also i've tried to remove bind_address, but even with serf_lan,wan and rpc parameters, consul refused to start because of multiple private ip address on the machine. |
Hi @shakisha and sorry for the trouble on this one. It looks like there's a bug where it's doing the private IP check, even though you've specified the
You are right that this type of configuration will result in Consul binding to all interfaces on a machine so you'd want to enable encryption for the serf ports and TLS w/verification for the RPC port. Many folks bind everything to the LAN interface and use a NAT / VPN / tunneled connection to avoid exposing anything externally. |
Also noting here that we should allow the configuration of a different bind address for LAN and WAN interfaces - this isn't currently supported. Linking #473 since it's related. |
Hi @slackpad,
this is very a GREAT idea, but how to do that if vpn is on tun0 interface and i have to listen on both eth1 (lan) and tun0 (vpn)? |
@shakisha I was thinking for the case where some other box provides the gateway - if the server itself has the tunnel then there's currently no way to support this other than bind 0.0.0.0 per #1914 (comment) and possibly some firewall rules to pare down the configuration. Once we get #473 and the option to bind (potentially multiple addresses) for each function (wan, lan, rpc) then this should get easier to configure. |
Thanks for your answer, but actually if i bind to 0.0.0.0 will bind to all interfaces? i can just open to all the interfaces and use iptables to block unwanted ports, tell me if i'm correct |
Yes - this config should bind to all interfaces:
The advertise addresses tell other hosts in the cluster how to contact the server. |
can i just put ? { Because i want to use lan and tun0 (vpn)... or you advice to use tun0 instead of wan_ip_address on this config? |
|
ok, but will this config listen to packets coming from tun0 interface? |
It should - it will bind to everything! |
Hi to all, are there any updates about this issue? :-) |
@shakisha please give the latest code in
Very few people should need to do anything as obscene as shown in the last example, but the functionality is there should you need it. I gave this issue a quick read and it seems like you could use this configuration enhancement to select the With the
There is now a configurable template language for examples and docs) behind this that you can use to create a customizable heuristic that should allow you to get whatever it is that you need from your environment when using an immutable image (see hashicorp/go-sockaddr/template and cmd/sockaddr. If this doesn't solve your issue, let us know. |
thanks for your answers. I explain better my situation so we can make a big step next to enhance this consul version; Actually i have got two datacenters: DC1 datacenter with only a single consul, wan connected machine. basically, from DC1 datacenter, i want query the DC2 datacenter to have got a list of pubblic ip addresses of all the DC2 machines (to use it with consul-template, another project from you which i love). So when running this command on the single consul machine of DC1:
or
i get in BOTH CASES
these are the configurations that i used: CONFIGURATION OF NODE ON DC1
CONFIGURATION OF NODE ON DC2
|
@shakisha Try with the following config snippets: CONFIGURATION OF NODE ON DC1 {
"server": true,
"datacenter": "DC1",
"data_dir": "/var/consul",
"log_level": "WARN",
"enable_syslog": false,
"encrypt": "secretkey",
"bind_addr": "{{ GetInterfaceIP \"eth1\" }}",
"advertise_addr_wan": "{{ GetInterfaceIP \"eth0\" }}",
"retry_join_wan": ["public ip of node2 on dc2", "public ip of node3 on dc2", "public ip of node4 on dc2"]
} You will have to plug in the IP/DNS addresses for If you want to test and experiment via the CLI, you can via:
Just be sure to re-escape the double quotes before injecting the working template back into your Consul config. Keep us posted! |
@sean- doing now 👍 |
Got
|
@sean- and if i push in this way i have got:
|
Comment updated. I think I copy/pasted the wrong set of examples in. The following two should work and be very close to the same in their result.
|
@sean- should i put these inside the configuration file?
Like
? |
Not quite, sorry. A few points (being explicit for future readers):
So for instance, you can pick one of the two following config blocks:
or:
Also, it isn't necessary to specify both Lines 147 to 159 in a67d308
|
Thanks @sean-
and i have got
on iptables i have got these rules:
|
Basically it seems that consul doesn't listen on port 8300 for the requests from wan machine. @slackpad have you got an idea? |
still debugging here; basically the wan requestes works if i set "bind" address to wan port only.
I have tried also with The question is: gives me connection refused? |
ok, i have identified the issue and got a workaround; if i set but if i set everything works perfectly ( i have at the moment a lot of Refuting a suspect message) but seems everything works. basically the RPC forwarding is not working as expected. -serf-wan-bind doesn't allow queries from other consul wan on port 8300 Why this issue? @slackpad is this a bug? |
my odissea with this issue continue.... i need to review my past comment, after some test, it i set the consul wan machine works, but election or local members will not work :-( the configuration file now has got the following values: "bind_addr": "PUBLIC IP", but election doesn't happen in this way. |
Hello, we have much better docs these days: https://learn.hashicorp.com/consul/security-networking/datacenters and I hope they solve your problem. If thats not the case feel free to open a new issue. Thanks for reporting! |
I have got my datacenter dc1 with various nodes, and i''ve bootstrapped datacenter2 dc2.
As told on this link (https://www.consul.io/docs/guides/datacenters.html), i need to launch command
but documentation isn't clear on this things:
The text was updated successfully, but these errors were encountered: