-E network.host doesn't work in VM


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= 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

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

(Mark Walkom) #2

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


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.

(Mark Walkom) #4

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


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

[2018-02-20T22:15:58,641][INFO ][o.e.t.TransportService ] [urZOilT] publish_address {}, bo
und_addresses {[::]:9300} is the VM's internal IP. I confirmed if I run curl 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.

(Mark Walkom) #6

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


Yes, I followed Running a basic Apache web server

The Hello World Apache server works:

ElasticSearch doesn't:

(Mark Walkom) #8

What does ip link show or ifconfig -a show?


$ 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

(Ryan Ernst) #10

Did you create a firewall rule allowing port 9200?


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=

now works. But

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

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.

(system) #12

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