What are the different ports used by consul? What is the purpose of each port? Is there any way to configure consul to run using different ports?
2 Answers
When reading the consul documentation you will find following information.
Ports Used
Consul requires up to 4 different ports to work properly, some on TCP, UDP, or both protocols. Below we document the requirements for each port.
- Server RPC (Default 8300). This is used by servers to handle incoming requests from other agents. TCP only.
- Serf LAN (Default 8301). This is used to handle gossip in the LAN. Required by all agents. TCP and UDP.
- Serf WAN (Default 8302). This is used by servers to gossip over the WAN to other servers. TCP and UDP.
- HTTP API (Default 8500). This is used by clients to talk to the HTTP API. TCP only.
- DNS Interface (Default 8600). Used to resolve DNS queries. TCP and UDP.
You can configure consul services to run on different ports by editing the config file. For example setting the dns interface on port 53 and the HTTP API on port 80. More details on port configuration is here.
{
"ports": {
"dns": 53,
"http": 80
}
}
-
2so what port should be mentioned with `-join` if we are not using default ports. Server RPC or Serf LAN – eldos Jun 07 '15 at 10:09
-
I'm pretty sure it's Server RPC. – Ztyx Jun 30 '16 at 16:00
-
what would be the key to change the RPC ports? – Andres A. Jul 12 '16 at 17:15
-
As mentioned in the docs it's "rpc" https://www.consul.io/docs/agent/options.html#dns_port – Patrick Hübl-Neschkudla Sep 27 '16 at 12:06
-
It seems that ports 21000-21255 are also needed if using the sidecar proxy. From my experimenting, only TCP is needed for these. https://www.consul.io/docs/install/ports.html – PeterM Apr 14 '19 at 13:41
-
Port 8501 is common for https (/ui) – bbaassssiiee Oct 10 '19 at 08:48
Minor update to the response from @Brrrr:
https://github.com/hashicorp/consul/blob/master/CHANGELOG.md#080-april-5-2017
All CLI commands that used RPC and the -rpc-addr flag to communicate with Consul have been converted to use the HTTP API and the appropriate flags for it, and the rpc field has been removed from the port and address binding configs.
So now the CLI uses TCP on 8500 like other clients.

- 51
- 1