# ES 2.1 only bind on localhost

**URL:** <https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720>\
**Category:** Elasticsearch\
**Created:** [December 9, 2015, 9:44am UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720 "2015-12-09T09:44:49Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![dopch](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dopch](https://discuss.elastic.co/u/dopch)\
**Post date:** [December 9, 2015, 9:44am UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/1 "2015-12-09T09:44:49Z")

</div>

Hello,

I have my ES 2.1 only listen on localhost however in my configuration i set `network.bind_host: ["_em1:ipv4_", "_lo:ipv4_", "_docker0:ipv4_"]` and `network.publish_host: _em1:ipv4_` any idea ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 9, 2015, 10:33am UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/2 "2015-12-09T10:33:55Z")

</div>

I'd use `network.host: _em1:ipv4_`

Would that work?

---

<div class="post-metadata">

**Author:** ![dopch](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dopch](https://discuss.elastic.co/u/dopch)\
**Post date:** [December 9, 2015, 10:56am UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/3 "2015-12-09T10:56:43Z")

</div>

The network.host setting is a simple setting to automatically set both network.bind\_host and network.publish\_host to the same host value.

If i use network.host: _em1:ipv4_ , my ES 2.1 only listen on em1 iface and i need listening on em1 ,lo and docker0 interfaces

---

<div class="post-metadata">

**Author:** ![dopch](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dopch](https://discuss.elastic.co/u/dopch)\
**Post date:** [December 9, 2015, 10:57am UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/4 "2015-12-09T10:57:59Z")

</div>

In emergency case i use network.host: 0.0.0.0 and my cluster is now listening on all interface but its not a good option

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 9, 2015, 11:34am UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/5 "2015-12-09T11:34:23Z")

</div>

I looked at the code and you should be able to set:

```auto
network.bind_host: ["_em1:ipv4_", "_lo:ipv4_", "_docker0:ipv4_"]
network.publish_host: _em1:ipv4_

```

Can you change the log level to debug and see what is happening?  
You should see some lines like:

```auto
binding server bootstrap to: XXXXX

```

---

<div class="post-metadata">

**Author:** ![dopch](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dopch](https://discuss.elastic.co/u/dopch)\
**Post date:** [December 9, 2015, 2:09pm UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/6 "2015-12-09T14:09:27Z")

</div>

I setup a VM with ES 2.1

elasticsearch.yml:

```auto
network.bind_host: ["_eth0:ipv4_", "_lo:ipv4_"]
network.publish_host: _eth0:ipv4_

```

```auto
[2015-12-09 15:02:31,319][DEBUG][http.netty] [Clea] Bound http to address {127.0.0.1:9200}
[2015-12-09 15:02:31,321][DEBUG][http.netty] [Clea] Bound http to address {[::1]:9200}
[2015-12-09 15:02:31,322][INFO][http] [Clea] publish_address {192.168.0.18:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}

```

Publish address looks ok but bound addresse failed

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 9, 2015, 4:59pm UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/7 "2015-12-09T16:59:23Z")

</div>

Just to make sure. Can you try:

```auto
network.bind_host: "NONEXSISTINGADDRESS"

```

And then:

```auto
network.bind_host: ["NONEXSISTINGADDRESS1", "NONEXSISTINGADDRESS2"]

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 9, 2015, 5:01pm UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/8 "2015-12-09T17:01:06Z")

</div>

Got it. Actually I tried it and when you set it as an array it's ignored!

Opening an issue... See [https://github.com/elastic/elasticsearch/issues/15340](https://github.com/elastic/elasticsearch/issues/15340)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 9, 2015, 5:21pm UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/9 "2015-12-09T17:21:23Z")

</div>

So I looked at the wrong code... I was looking at 2.x branch but things changed!

Binding to multiple addresses is only supported in coming 2.2 version: [https://github.com/elastic/elasticsearch/pull/13954](https://github.com/elastic/elasticsearch/pull/13954)

---

<div class="post-metadata">

**Author:** ![Dmytro\_Zharii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dmytro_zharii/32/6593_2.png) [@Dmytro\_Zharii](https://discuss.elastic.co/u/Dmytro_Zharii)\
**Post date:** [December 13, 2015, 8:26am UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/10 "2015-12-13T08:26:30Z")

</div>

I've had this issue on Windows Server 2012 R2 and I have workarounded it by setting all  
3 parameters to the current machine IP address:

```auto
network.host: 192.168.1.100
network.bind_host: 192.168.1.100
network.publish_host: 192.168.1.100

```

But that disables localhost connections.

To allow localhost on some nodes I've set:

```auto
network.bind_host: 0.0.0.0

```

---

<div class="post-metadata">

**Author:** ![zokratez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zokratez/32/5974_2.png) [@zokratez](https://discuss.elastic.co/u/zokratez)\
**Post date:** [December 29, 2015, 2:03pm UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/12 "2015-12-29T14:03:31Z")

</div>

This work for me... But is this correct?

---

<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:** [July 5, 2017, 11:28pm UTC](https://discuss.elastic.co/t/es-2-1-only-bind-on-localhost/36720/13 "2017-07-05T23:28:04Z")

</div>


