# Can't hit API on non-loopback IP

**URL:** <https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048>\
**Category:** Elasticsearch\
**Created:** [April 21, 2020, 1:18pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048 "2020-04-21T13:18:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hmcguire](https://avatars.discourse-cdn.com/v4/letter/h/9de0a6/32.png) [@hmcguire](https://discuss.elastic.co/u/hmcguire)\
**Post date:** [April 21, 2020, 1:18pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/1 "2020-04-21T13:18:15Z")

</div>

I have just setup a new dev 7.6.2 single-node cluster via rpm on centos 7 and am unable to curl the API on the non-loopback address. Curl to localhost works fine and I can also telnet to the default port of 9200 of the non-loopback address from another host. I have tried many different variations for network host including special **site** , ip addr, 0.0.0.0, and 0. This is a POC so I am not trying to configure very much beyond defaults. I have no issues with the service starting in regards to the bootstrap checks for single node cluster. Any help would be much appreciated.

Relevant elasticsearch.yml network/http settings I have explicitly set in file:  
network.host: 0  
http.port: 9200

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajeev_bhat/32/66529_2.png) [@Rajeev\_Bhat](https://discuss.elastic.co/u/Rajeev_Bhat)\
**Post date:** [April 21, 2020, 1:43pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/2 "2020-04-21T13:43:52Z")

</div>

Try this in elasticsearch.yml:  
network.host: ["ipAddress"]  
discovery.type: single-node

And restart the elastic service

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajeev_bhat/32/66529_2.png) [@Rajeev\_Bhat](https://discuss.elastic.co/u/Rajeev_Bhat)\
**Post date:** [April 21, 2020, 1:49pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/3 "2020-04-21T13:49:58Z")

</div>

ipAddress is the public IP address of the device which you have set up ES.

---

<div class="post-metadata">

**Author:** ![hmcguire](https://avatars.discourse-cdn.com/v4/letter/h/9de0a6/32.png) [@hmcguire](https://discuss.elastic.co/u/hmcguire)\
**Post date:** [April 21, 2020, 1:53pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/4 "2020-04-21T13:53:18Z")

</div>

Thank you for your reply, but unfortunately this did not fix the communication issue. Additionally I have no issue with the service starting as a single node cluster and electing itself as master.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajeev_bhat/32/66529_2.png) [@Rajeev\_Bhat](https://discuss.elastic.co/u/Rajeev_Bhat)\
**Post date:** [April 21, 2020, 1:54pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/5 "2020-04-21T13:54:22Z")

</div>

Can you share what is the error are you getting?

---

<div class="post-metadata">

**Author:** ![hmcguire](https://avatars.discourse-cdn.com/v4/letter/h/9de0a6/32.png) [@hmcguire](https://discuss.elastic.co/u/hmcguire)\
**Post date:** [April 21, 2020, 1:57pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/6 "2020-04-21T13:57:45Z")

</div>

I receive no error as far as the service goes. The issue is I am unable to communicate/receive a response from the api on the non-loopback address via curl on port 9200, despite the server being bound to said port and also being able to successfully telnet to 9200 from a different host as well.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajeev_bhat/32/66529_2.png) [@Rajeev\_Bhat](https://discuss.elastic.co/u/Rajeev_Bhat)\
**Post date:** [April 21, 2020, 1:59pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/7 "2020-04-21T13:59:15Z")

</div>

When the service starts can you see what is the publish address in the logs?

---

<div class="post-metadata">

**Author:** ![hmcguire](https://avatars.discourse-cdn.com/v4/letter/h/9de0a6/32.png) [@hmcguire](https://discuss.elastic.co/u/hmcguire)\
**Post date:** [April 21, 2020, 2:11pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/8 "2020-04-21T14:11:31Z")

</div>

yes, and it looks correct. From log file:

`publish_address {10.240.10.221:9200}, bound_addresses {0.0.0.0:9200}`

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajeev_bhat/32/66529_2.png) [@Rajeev\_Bhat](https://discuss.elastic.co/u/Rajeev_Bhat)\
**Post date:** [April 21, 2020, 2:15pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/9 "2020-04-21T14:15:06Z")

</div>

if you put network.host:["10.240.10.221"] in yml file , I think bound address should be 10.240.10.221:9200.  
Have you assigned 0 to network.host?

---

<div class="post-metadata">

**Author:** ![hmcguire](https://avatars.discourse-cdn.com/v4/letter/h/9de0a6/32.png) [@hmcguire](https://discuss.elastic.co/u/hmcguire)\
**Post date:** [April 21, 2020, 2:31pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/10 "2020-04-21T14:31:06Z")

</div>

I just tried your suggestion, and still am unable to get a response via curl.  
From log file:  
`publish_address {10.240.10.221:9200}, bound_addresses {10.240.10.221:9200}`

I also tried not using 0, and using [_local_, "10.240.10.221"]  
From log file:  
`publish_address {10.240.10.221:9200}, bound_addresses {127.0.0.1:9200}, {10.240.10.221:9200}`

Same result, works with loopback but not with ip addr and I can successfully telnet from another host on 10.240.10.221:9200. so it doesn't seem to be comm/firewall issue. Very confused!

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajeev_bhat/32/66529_2.png) [@Rajeev\_Bhat](https://discuss.elastic.co/u/Rajeev_Bhat)\
**Post date:** [April 21, 2020, 2:32pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/11 "2020-04-21T14:32:11Z")

</div>

use only ["10.240.10.221"]. It should work according to me.  
Then you can only hit to "10.240.10.221" but not localhost, but it should be fine right?

---

<div class="post-metadata">

**Author:** ![hmcguire](https://avatars.discourse-cdn.com/v4/letter/h/9de0a6/32.png) [@hmcguire](https://discuss.elastic.co/u/hmcguire)\
**Post date:** [April 21, 2020, 2:34pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/12 "2020-04-21T14:34:52Z")

</div>

yes, that is what I tried first. From the above, with no luck.

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajeev_bhat/32/66529_2.png) [@Rajeev\_Bhat](https://discuss.elastic.co/u/Rajeev_Bhat)\
**Post date:** [April 21, 2020, 2:37pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/13 "2020-04-21T14:37:59Z")

</div>

Ok. Can you share the curl call?

---

<div class="post-metadata">

**Author:** ![hmcguire](https://avatars.discourse-cdn.com/v4/letter/h/9de0a6/32.png) [@hmcguire](https://discuss.elastic.co/u/hmcguire)\
**Post date:** [April 21, 2020, 2:51pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/14 "2020-04-21T14:51:05Z")

</div>

hitting localhost:  
`curl localhost:9200` - This works  
trying from ES host itself and another host(can telnet over 9200 from this host):  
`curl 10.240.10.221:9200` - doesn't work

---

<div class="post-metadata">

**Author:** ![Rajeev\_Bhat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajeev_bhat/32/66529_2.png) [@Rajeev\_Bhat](https://discuss.elastic.co/u/Rajeev_Bhat)\
**Post date:** [April 21, 2020, 2:53pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/15 "2020-04-21T14:53:52Z")

</div>

Looks fine to me. May be @dadoonet can help

---

<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:** [April 21, 2020, 3:16pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/16 "2020-04-21T15:16:39Z")

</div>

Did you check if there is a firewall or something?

---

<div class="post-metadata">

**Author:** ![hmcguire](https://avatars.discourse-cdn.com/v4/letter/h/9de0a6/32.png) [@hmcguire](https://discuss.elastic.co/u/hmcguire)\
**Post date:** [April 21, 2020, 3:31pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/17 "2020-04-21T15:31:18Z")

</div>

Both of these hosts have firewalld disabled for testing. They are two EC2 instances in the same security group with these ports open and I have successfully been able to telnet over port 9200 to the elasticsearch host from the other host. I have not configured the EC2 discovery plugin, although I may be incorrect seeing it as optional. Am I missing something that would be specific to it being cloud servers?

---

<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:** [April 21, 2020, 5:30pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/18 "2020-04-21T17:30:56Z")

</div>

Are you saying that you can `telnet` IP:9200 but not `curl`?

---

<div class="post-metadata">

**Author:** ![hmcguire](https://avatars.discourse-cdn.com/v4/letter/h/9de0a6/32.png) [@hmcguire](https://discuss.elastic.co/u/hmcguire)\
**Post date:** [April 21, 2020, 5:54pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/19 "2020-04-21T17:54:57Z")

</div>

@dadoonet Correct

---

<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:** [April 21, 2020, 6:30pm UTC](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048/20 "2020-04-21T18:30:31Z")

</div>

Once you are connected with telnet can you run a GET / ?

[Next page](https://discuss.elastic.co/t/cant-hit-api-on-non-loopback-ip/229048.md?page=2)
