# How to bind the public IP?

**URL:** <https://discuss.elastic.co/t/how-to-bind-the-public-ip/207318>\
**Category:** Elasticsearch\
**Created:** [November 11, 2019, 9:49am UTC](https://discuss.elastic.co/t/how-to-bind-the-public-ip/207318 "2019-11-11T09:49:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pinno\_Lin](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@Pinno\_Lin](https://discuss.elastic.co/u/Pinno_Lin)\
**Post date:** [November 11, 2019, 9:49am UTC](https://discuss.elastic.co/t/how-to-bind-the-public-ip/207318/1 "2019-11-11T09:49:19Z")

</div>

Hi All,  
I have 4 node prepare to 1 master (172.20.9.45, 192.168.1.1) and 3 data node (192.168.1.11 ~13). The 172.20.9.x is public LAN, 192.168.1.x is private LAN by hub. The ES version : 7.4.0

these is my elasticsearch.yml for per node.  
**Master node:**  
node.name: oaelk2-em01  
node.master: true  
node.data: false  
network.host: oaelk2-em01  
discovery.seed\_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]  
cluster.initial\_master\_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]

**Data node** (oaelk2-ed01)  
node.name: oaelk2-ed01  
node.master: false  
node.data: true  
network.host: oaelk2-ed01  
discovery.seed\_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]  
cluster.initial\_master\_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]

**Data node** (oaelk2-ed02)  
node.name: oaelk2-ed02  
node.master: false  
node.data: true  
network.host: oaelk2-ed02  
discovery.seed\_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]  
cluster.initial\_master\_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]

**Data node** (oaelk2-ed03)  
node.name: oaelk2-ed03  
node.master: false  
node.data: true  
network.host: oaelk2-ed03  
discovery.seed\_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]  
cluster.initial\_master\_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]

These is /etc/hosts for per node (master & data node)  
192.168.1.1 OAELK2-EM01  
192.168.1.11 OAELK2-ED01  
192.168.1.12 OAELK2-ED02  
192.168.1.13 OAELK2-ED03

But just only use 192.168.1.1 can connect to ES Master, 172.20.9.45 Can't to connect .

[root@OAELK2-EM01 data]# curl [http://192.168.1.1:9200/\_cat/nodes?v](http://192.168.1.1:9200/_cat/nodes?v)  
ip heap.percent ram.percent cpu load\_1m load\_5m load\_15m node.role master name  
192.168.1.12 2 25 0 0.00 0.01 0.05 dil - oaelk2-ed02  
192.168.1.11 2 24 0 0.00 0.01 0.05 dil - oaelk2-ed01  
192.168.1.13 2 25 0 0.00 0.01 0.05 dil - oaelk2-ed03  
192.168.1.1 2 24 0 0.00 0.01 0.05 ilm \* oaelk2-em01  
[root@OAELK2-EM01 data]# curl [http://172.20.9.45:9200/\_cat/nodes?v](http://172.20.9.45:9200/_cat/nodes?v)  
curl: (7) Failed connect to 172.20.9.45:9200; Connection refused

How to bind the public IP??? Thank a lot.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 11, 2019, 10:16am UTC](https://discuss.elastic.co/t/how-to-bind-the-public-ip/207318/2 "2019-11-11T10:16:53Z")

</div>

your /etc/hosts only contains `192.168` ips, you bind to hosts mentioned in the `/etc/hosts` - can you explain why you then expect to bind to another IP address that has not been specified anywhere? Maybe I am missing something in the configuration setup.

You can set the `network.host` setting to be bound to an interface or simply `0.0.0.0` to listen to all interfaces.

---

<div class="post-metadata">

**Author:** ![Pinno\_Lin](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@Pinno\_Lin](https://discuss.elastic.co/u/Pinno_Lin)\
**Post date:** [November 12, 2019, 1:22am UTC](https://discuss.elastic.co/t/how-to-bind-the-public-ip/207318/3 "2019-11-12T01:22:43Z")

</div>

Hi,  
Thank for your reply. Because all node in private LAN, just only master node need to accept request from outside, so the master node have 2 IP (172.20.9.45, 192.168.1.1) .  
I has try to add the public IP in /etc/hosts and change network.host to 0.0.0.0 for per node. but it still not successful. the data node can't discover master node.

**/etc/hosts** (per node)  
172.20.9.45 OAELK2-EM01  
192.168.1.1 OAELK2-EM01  
192.168.1.11 OAELK2-ED01  
192.168.1.12 OAELK2-ED02  
192.168.1.13 OAELK2-ED03  
**Master node**  
cluster.name: es\_c2  
node.name: oaelk2-em01  
node.master: true  
node.data: false  
network.host: 0.0.0.0  
discovery.seed\_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]  
cluster.initial\_master\_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]  
**Data node** (oaelk2-ed01)  
cluster.name: es\_c2  
node.name: oaelk2-ed01  
node.master: false  
node.data: true  
network.host: 0.0.0.0  
discovery.seed\_hosts: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]  
cluster.initial\_master\_nodes: ["oaelk2-em01", "oaelk2-ed01", "oaelk2-ed02", "oaelk2-ed03"]  
**Data node can't discover master node.**  
[root@OAELK2-EM01 data]# curl [http://172.20.9.45:9200/\_cat/nodes?v](http://172.20.9.45:9200/_cat/nodes?v)  
ip heap.percent ram.percent cpu load\_1m load\_5m load\_15m node.role master name  
172.20.9.45 1 24 0 0.01 0.06 0.06 ilm \* oaelk2-em01  
[root@OAELK2-EM01 data]# curl [http://192.168.1.1:9200/\_cat/nodes?v](http://192.168.1.1:9200/_cat/nodes?v)  
ip heap.percent ram.percent cpu load\_1m load\_5m load\_15m node.role master name  
172.20.9.45 1 24 0 0.01 0.06 0.06 ilm \* oaelk2-em01  
**Data node log:**  
[2019-11-12T17:20:55,306][WARN][o.e.c.c.ClusterFormationFailureHelper] [oaelk2-ed01] master not discovered yet: have discovered [{oaelk2-ed01}{\_0R4mR4aS1-aPfJAUYK1ww}{x-Bo4flrQjy2flKQ\_a00YQ}{192.168.1.11}{192.168.1.11:9300}{dil}{ml.machine\_memory=152102723584, xpack.installed=true, ml.max\_open\_jobs=20}]; discovery will continue using [192.168.1.1:9300, 172.20.9.45:9300, 192.168.1.12:9300, 192.168.1.13:9300] from hosts providers and from last-known cluster state; node term 17, last-accepted version 78 in term 17

---

<div class="post-metadata">

**Author:** ![Pinno\_Lin](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@Pinno\_Lin](https://discuss.elastic.co/u/Pinno_Lin)\
**Post date:** [November 12, 2019, 9:58am UTC](https://discuss.elastic.co/t/how-to-bind-the-public-ip/207318/4 "2019-11-12T09:58:45Z")

</div>

Hi,  
I had resolved my issue. Add the network.bind\_host and network.publish\_host in master node. it's work.  
network.bind\_host: ["192.168.1.1","172.20.9.45"]  
network.publish\_host: 192.168.1.1

Thank a lot.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 10, 2019, 10:07am UTC](https://discuss.elastic.co/t/how-to-bind-the-public-ip/207318/5 "2019-12-10T10:07:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
