# \-E network.host doesn't work in VM

**URL:** <https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730>\
**Category:** Elasticsearch\
**Created:** [February 20, 2018, 9:51pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730 "2018-02-20T21:51:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![melissachang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/melissachang/32/36684_2.png) [@melissachang](https://discuss.elastic.co/u/melissachang)\
**Post date:** [February 20, 2018, 9:51pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/1 "2018-02-20T21:51:10Z")

</div>

I'm trying to run ElasticSearch and view the webpage from a different machine.

On my Debian desktop,  
`elasticsearch-5.0.1/bin/elasticsearch -E network.host=100.96.149.173` works. I can access machine\_hostname:9200.

But running the same command in a Google Compute Engine VM gives:

[2018-02-20T21:45:54,967][WARN][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thre  
ad [main]  
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300-9400]]; nested  
: BindException[Cannot assign requested address];  
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-5.0.2.jar  
:5.0.2]

It appears I need a different set of flags for VMs, but I can't figure out what.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 20, 2018, 10:07pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/2 "2018-02-20T22:07:36Z")

</div>

Can you show the complete command you are using on the VM?

---

<div class="post-metadata">

**Author:** ![melissachang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/melissachang/32/36684_2.png) [@melissachang](https://discuss.elastic.co/u/melissachang)\
**Post date:** [February 20, 2018, 10:10pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/3 "2018-02-20T22:10:07Z")

</div>

`elasticsearch-5.0.2/bin/elasticsearch -E network.host=<external ip address>`

I also tried discovery-gce plugin. If I do `elasticsearch-5.0.2/bin/elasticsearch -E network.host=_gce:hostname_` or `elasticsearch-5.0.2/bin/elasticsearch -E network.host=_gce_`, I can curl against internal IP. But I want to curl against external IP. There doesn't seem to be a discovery-gce option for that.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 20, 2018, 10:13pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/4 "2018-02-20T22:13:04Z")

</div>

`elasticsearch-5.0.2/bin/elasticsearch -E network.host=0.0.0.0` should bind to all IPs.

---

<div class="post-metadata">

**Author:** ![melissachang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/melissachang/32/36684_2.png) [@melissachang](https://discuss.elastic.co/u/melissachang)\
**Post date:** [February 20, 2018, 10:18pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/5 "2018-02-20T22:18:41Z")

</div>

That doesn't work. If I run that, I get:

[2018-02-20T22:15:58,641][INFO][o.e.t.TransportService] [urZOilT] publish\_address {10.138.0.4:9300}, bo  
und\_addresses {[::]:9300}

10.138.0.4 is the VM's internal IP. I confirmed if I run `curl 10.138.0.4:9200` inside VM works. But loading external\_ip:9200 from outside the VM doesn't work.

This should be easy for you to reproduce, just create a Debian VM on Google Compute Engine.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 20, 2018, 10:19pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/6 "2018-02-20T22:19:16Z")

</div>

Is the external address actually bound to an interface on the VM then?

---

<div class="post-metadata">

**Author:** ![melissachang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/melissachang/32/36684_2.png) [@melissachang](https://discuss.elastic.co/u/melissachang)\
**Post date:** [February 20, 2018, 10:25pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/7 "2018-02-20T22:25:20Z")

</div>

Yes, I followed [Running a basic Apache web server](https://cloud.google.com/compute/docs/tutorials/basic-webserver-apache)

The Hello World Apache server works: [http://35.230.120.179/](http://35.230.120.179/)

ElasticSearch doesn't: [http://35.230.120.179:9200/](http://35.230.120.179:9200/)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 20, 2018, 10:28pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/8 "2018-02-20T22:28:59Z")

</div>

What does `ip link show` or `ifconfig -a` show?

---

<div class="post-metadata">

**Author:** ![melissachang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/melissachang/32/36684_2.png) [@melissachang](https://discuss.elastic.co/u/melissachang)\
**Post date:** [February 20, 2018, 10:33pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/9 "2018-02-20T22:33:18Z")

</div>

$ ip link show  
1: lo: \<LOOPBACK,UP,LOWER\_UP\> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1  
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  
2: eth0: \<BROADCAST,MULTICAST,UP,LOWER\_UP\> mtu 1460 qdisc mq state UP mode DEFAULT group default qlen 1000  
link/ether 42:01:0a:8a:00:04 brd ff:ff:ff:ff:ff:ff

$ ifconfig -a  
-bash: ifconfig: command not found

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [February 21, 2018, 9:48pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/10 "2018-02-21T21:48:11Z")

</div>

Did you create a firewall rule allowing port 9200?

---

<div class="post-metadata">

**Author:** ![melissachang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/melissachang/32/36684_2.png) [@melissachang](https://discuss.elastic.co/u/melissachang)\
**Post date:** [February 21, 2018, 10:23pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/11 "2018-02-21T22:23:05Z")

</div>

I thought I did, but it turns out my firewall rule only allowed 80. I changed to allow all ports.

`elasticsearch-5.0.2/bin/elasticsearch -E network.host=0.0.0.0`

now works. But

`elasticsearch-5.0.2/bin/elasticsearch -E network.host=35.230.120.179`

still gives BindTransportException error from above. Should I file a bug?

From googling, it seems like there might be a magic combination of flags that work, but I'm not sure what they are.

Should be easy for anyone to repro. Just create a Debian VM on Google Compute Engine. You [should not be charged](https://cloud.google.com/free/).

---

<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 21, 2018, 10:23pm UTC](https://discuss.elastic.co/t/e-network-host-doesnt-work-in-vm/120730/12 "2018-03-21T22:23:15Z")

</div>

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