# Elasticsearch only binds to localhost but not IP / hostname / fqdn hostname - WHY?

**URL:** <https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198>\
**Category:** Elasticsearch\
**Created:** [February 23, 2021, 11:46am UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198 "2021-02-23T11:46:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![smm](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@smm](https://discuss.elastic.co/u/smm)\
**Post date:** [February 23, 2021, 11:46am UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198/1 "2021-02-23T11:46:04Z")

</div>

Hi there,  
I am wondering: build a multinode stack. On a stack I would llike to to a:  
curl -s -k -u elastic:changeme -XGET [https://SOMETHING:9200/\_cat/health](https://SOMETHING:9200/_cat/health)

If SOMETHING is:  
127.0.0.1 or localhost it works  
machine ip / hostname / fqdn hostanme it does nothing

Running on ubuntu 20.04lts and /etc/hosts has name, fqdn name, ip set.  
I tested various elasticsearchy.yml variations, but it does not work.  
Any idea why or how?

Running 7.8.1  
Doc: [Network settings | Elasticsearch Reference [7.8] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.8/modules-network.html)

I would like to bid it to an Ip like 10.16.x.y, so no 192.168.x.y.  
cheers  
Stefano

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [February 23, 2021, 11:57am UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198/2 "2021-02-23T11:57:14Z")

</div>

You should set `network.host`, which is the first thing described by the docs you linked. As per those docs it defaults to `_local_`.

---

<div class="post-metadata">

**Author:** ![smm](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@smm](https://discuss.elastic.co/u/smm)\
**Post date:** [February 23, 2021, 12:02pm UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198/3 "2021-02-23T12:02:13Z")

</div>

At the moment I have this config running:  
...

# ---------------------------------- Network -----------------------------------

# 

# Set the bind address to a specific IP (IPv4 or IPv6):

# 

network.host: ["_site_","_local_"]  
#network.host: ["_site_"]  
#network.host: ["_global_"]  
#network.host: ["_global_"]  
#network.host: ["_[ens160]_"]  
network.publish\_host: 10.16.x,y  
#network.bind\_host: 0  
...

---

<div class="post-metadata">

**Author:** ![smm](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@smm](https://discuss.elastic.co/u/smm)\
**Post date:** [February 23, 2021, 12:07pm UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198/4 "2021-02-23T12:07:07Z")

</div>

...doing this:  
network.host: ["_site_"]  
I get the curl check just hanging while directing it to the 10.16.x.y.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [February 23, 2021, 12:07pm UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198/5 "2021-02-23T12:07:48Z")

</div>

`network.bind_host` and `network.publish_host` are [advanced settings](https://www.elastic.co/guide/en/elasticsearch/reference/7.8/modules-network.html#advanced-network-settings) and probably just adding to your confusion.

Just set `network.host` to the address you want.

---

<div class="post-metadata">

**Author:** ![smm](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@smm](https://discuss.elastic.co/u/smm)\
**Post date:** [February 23, 2021, 12:13pm UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198/6 "2021-02-23T12:13:42Z")

</div>

...so I did as you said.  
Log:  
[2021-02-23T13:09:48,771][INFO][o.e.x.s.s.SecurityStatusChangeListener] [[test-prod-master-dus301001-1.logging.msys.net](http://test-prod-master-dus301001-1.logging.msys.net)] Active license is now [BASIC]; Security is enabled  
[2021-02-23T13:09:48,823][INFO][o.e.h.AbstractHttpServerTransport] [[test-prod-master-dus301001-1.logging.msys.net](http://test-prod-master-dus301001-1.logging.msys.net)] publish\_address {10.16.x.y:9200}, bound\_addresses {10.16.147.205:9200}  
[2021-02-23T13:09:48,824][INFO][o.e.n.Node] [[test-prod-master-dus301001-1.logging.msys.net](http://test-prod-master-dus301001-1.logging.msys.net)] started

yml like this:

# ---------------------------------- Network -----------------------------------

# 

# Set the bind address to a specific IP (IPv4 or IPv6):

# 

#network.host: ["_site_","_local_"]  
#network.host: ["_site_"]  
network.host: ["10.16.x.y"]  
#network.host: ["_[ens160]_"]

# network.publish\_host: 10.16.147.205

#network.bind\_host: 0

# 

# Set a custom port for HTTP:

# 

#http.port: 9200

# 

# For more information, consult the network module documentation.

# 

But the curl test just hangs with:  
curl -s -k -u elastic:changeme -XGET [https://10.16.x.y:9200/\_cat/health](https://10.16.x.y:9200/_cat/health)  
Any idea why?  
Thank you!

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [February 23, 2021, 12:18pm UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198/7 "2021-02-23T12:18:04Z")

</div>

Assuming `10.16.x.y` is `10.16.147.205` I've no idea. Elasticsearch says it's listening on that address.

---

<div class="post-metadata">

**Author:** ![smm](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@smm](https://discuss.elastic.co/u/smm)\
**Post date:** [February 23, 2021, 12:20pm UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198/8 "2021-02-23T12:20:55Z")

</div>

Yes, that is the IP. Telnet to that IP an 9200 works well.  
Thank you anyway!

---

<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:** [March 23, 2021, 12:21pm UTC](https://discuss.elastic.co/t/elasticsearch-only-binds-to-localhost-but-not-ip-hostname-fqdn-hostname-why/265198/9 "2021-03-23T12:21:20Z")

</div>

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