# Can´t connect to dedicated serach server

**URL:** https://discuss.elastic.co/t/can-t-connect-to-dedicated-serach-server/6591
**Category:** Elasticsearch
**Created:** [February 4, 2012, 4:30am UTC](https://discuss.elastic.co/t/can-t-connect-to-dedicated-serach-server/6591 "2012-02-04T04:30:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mrblue](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrblue/32/23268_2.png) [@mrblue](https://discuss.elastic.co/u/mrblue)
#### Post date: [February 4, 2012, 4:30am UTC](https://discuss.elastic.co/t/can-t-connect-to-dedicated-serach-server/6591/1 "2012-02-04T04:30:08Z")

</div>

Hi,

i decided to set up a dedicated server just for elasticsearch (debian  
6.0 squeeze 64 lamp). ES works fine so far, but i can´t connect to it  
from another server.

Here is a very simple example:

$ch = curl\_init();  
//curl\_setopt($ch, CURLOPT\_URL, "[http://localhost:9200/alle\_uhren/](http://localhost:9200/alle_uhren/)  
\_search?pretty=true");

curl\_setopt($ch, CURLOPT\_URL, "[http://xxx.x.xxx.xxx:9200/xxxx/\_search](http://xxx.x.xxx.xxx:9200/xxxx/_search)?  
pretty=true");

curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);  
curl\_setopt($ch, CURLOPT\_POST, true);

$data = '{  
"query" : {  
"match\_all" : { }  
},"size" : "2000"  
}';

curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data);  
$jason\_output = curl\_exec($ch);  
$info = curl\_getinfo($ch);  
curl\_close($ch);

print\_r($jason\_output);

It works fine with localhost, but not from a different server. I can  
ping from one server to the other.  
Here is what netstat says, there seems to be somthing on 9200, but i  
know nothing about these kind of things 😉

tcp 0 0 127.0.0.1:3306 0.0.0.0:\*  
LISTEN  
tcp 0 0 0.0.0.0:10000 0.0.0.0:\*  
LISTEN  
tcp 0 0 0.0.0.0:80 0.0.0.0:\*  
LISTEN  
tcp 0 0 0.0.0.0:22 0.0.0.0:\*  
LISTEN  
tcp 0 0 127.0.0.1:25 0.0.0.0:\*  
LISTEN  
tcp 0 0 127.0.0.1:32000 0.0.0.0:\*  
LISTEN  
tcp6 0 0 :::9200 :::\*  
LISTEN  
tcp6 0 0 :::9300 :::\*  
LISTEN  
tcp6 0 0 :::21 :::\*  
LISTEN  
tcp6 0 0 :::22 :::\*  
LISTEN  
tcp6 0 0 ::1:25 :::\*  
LISTEN

Any help is apreciated !

---

<div class="post-metadata">

### Author: ![avasilenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/avasilenko/32/2901_2.png) [@avasilenko](https://discuss.elastic.co/u/avasilenko)
#### Post date: [February 4, 2012, 7:26am UTC](https://discuss.elastic.co/t/can-t-connect-to-dedicated-serach-server/6591/2 "2012-02-04T07:26:55Z")

</div>

You should check iptables rules:

> $ iptables -L

And print it here. Probably 9200 port is blocked. As an example in CentOS  
all ports, except 22 are blocked for external access.

Alexandr Vasilenko

2012/2/4 mrblue [john.agricola.27@googlemail.com](mailto:john.agricola.27@googlemail.com)

> Hi,
> 
> i decided to set up a dedicated server just for elasticsearch (debian  
> 6.0 squeeze 64 lamp). ES works fine so far, but i can´t connect to it  
> from another server.
> 
> Here is a very simple example:
> 
> $ch = curl\_init();  
> //curl\_setopt($ch, CURLOPT\_URL, "[http://localhost:9200/alle\_uhren/](http://localhost:9200/alle_uhren/)  
> \_search?pretty=true");
> 
> curl\_setopt($ch, CURLOPT\_URL, "[http://xxx.x.xxx.xxx:9200/xxxx/\_search](http://xxx.x.xxx.xxx:9200/xxxx/_search)?  
> pretty=true");
> 
> curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);  
> curl\_setopt($ch, CURLOPT\_POST, true);
> 
> $data = '{  
> "query" : {  
> "match\_all" : { }  
> },"size" : "2000"  
> }';
> 
> curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data);  
> $jason\_output = curl\_exec($ch);  
> $info = curl\_getinfo($ch);  
> curl\_close($ch);
> 
> print\_r($jason\_output);
> 
> It works fine with localhost, but not from a different server. I can  
> ping from one server to the other.  
> Here is what netstat says, there seems to be somthing on 9200, but i  
> know nothing about these kind of things 😉
> 
> tcp 0 0 127.0.0.1:3306 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 0.0.0.0:10000 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 0.0.0.0:80 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 0.0.0.0:22 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 127.0.0.1:25 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 127.0.0.1:32000 0.0.0.0:\*  
> LISTEN  
> tcp6 0 0 :::9200 :::\*  
> LISTEN  
> tcp6 0 0 :::9300 :::\*  
> LISTEN  
> tcp6 0 0 :::21 :::\*  
> LISTEN  
> tcp6 0 0 :::22 :::\*  
> LISTEN  
> tcp6 0 0 ::1:25 :::\*  
> LISTEN
> 
> Any help is apreciated !

---

<div class="post-metadata">

### Author: ![Aurelien\_2](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@Aurelien\_2](https://discuss.elastic.co/u/Aurelien_2)
#### Post date: [February 4, 2012, 7:52am UTC](https://discuss.elastic.co/t/can-t-connect-to-dedicated-serach-server/6591/3 "2012-02-04T07:52:10Z")

</div>

Hello.

You may also check if localhost resolve to the local ipv6 address, or try -Djava.net.preferIPv4Stack=true on the java startup command line. Or disable ipv6 on your box if you don't use it.

Rgds.

----- Mail original -----

De: "Alex Vasilenko" [aa.vasilenko@gmail.com](mailto:aa.vasilenko@gmail.com)  
À: [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Envoyé: Samedi 4 Février 2012 08:26:55  
Objet: Re: Can´t connect to dedicated serach server

You should check iptables rules:

> $ iptables -L 
> 
> And print it here. Probably 9200 port is blocked. As an example in CentOS all ports, except 22 are blocked for external access.
> 
> Alexandr Vasilenko
> 
> 2012/2/4 mrblue \< [john.agricola.27@googlemail.com](mailto:john.agricola.27@googlemail.com) \>
> 
> > Hi, 
> > 
> > i decided to set up a dedicated server just for elasticsearch (debian  
> > 6.0 squeeze 64 lamp). ES works fine so far, but i can´t connect to it  
> > from another server.
> > 
> > Here is a very simple example:
> > 
> > $ch = curl\_init();  
> > //curl\_setopt($ch, CURLOPT\_URL, " [http://localhost:9200/alle\_uhren/](http://localhost:9200/alle_uhren/)  
> > \_search?pretty=true ");
> > 
> > curl\_setopt($ch, CURLOPT\_URL, " [http://xxx.x.xxx.xxx:9200/xxxx/\_search](http://xxx.x.xxx.xxx:9200/xxxx/_search)?  
> > pretty=true ");
> > 
> > curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);  
> > curl\_setopt($ch, CURLOPT\_POST, true);
> > 
> > $data = '{  
> > "query" : {  
> > "match\_all" : { }  
> > },"size" : "2000"  
> > }';
> > 
> > curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data);  
> > $jason\_output = curl\_exec($ch);  
> > $info = curl\_getinfo($ch);  
> > curl\_close($ch);
> > 
> > print\_r($jason\_output);
> > 
> > It works fine with localhost, but not from a different server. I can  
> > ping from one server to the other.  
> > Here is what netstat says, there seems to be somthing on 9200, but i  
> > know nothing about these kind of things 😉
> > 
> > tcp 0 0 127.0.0.1:3306 0.0.0.0:\*  
> > LISTEN  
> > tcp 0 0 0.0.0.0:10000 0.0.0.0:\*  
> > LISTEN  
> > tcp 0 0 0.0.0.0:80 0.0.0.0:\*  
> > LISTEN  
> > tcp 0 0 0.0.0.0:22 0.0.0.0:\*  
> > LISTEN  
> > tcp 0 0 127.0.0.1:25 0.0.0.0:\*  
> > LISTEN  
> > tcp 0 0 127.0.0.1:32000 0.0.0.0:\*  
> > LISTEN  
> > tcp6 0 0 :::9200 :::\*  
> > LISTEN  
> > tcp6 0 0 :::9300 :::\*  
> > LISTEN  
> > tcp6 0 0 :::21 :::\*  
> > LISTEN  
> > tcp6 0 0 :::22 :::\*  
> > LISTEN  
> > tcp6 0 0 ::1:25 :::\*  
> > LISTEN
> > 
> > Any help is apreciated !

---

<div class="post-metadata">

### Author: ![Greg](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Greg](https://discuss.elastic.co/u/Greg)
#### Post date: [February 4, 2012, 12:01pm UTC](https://discuss.elastic.co/t/can-t-connect-to-dedicated-serach-server/6591/4 "2012-02-04T12:01:33Z")

</div>

The problem is that it's only listening on port 9200 for IPv6, not  
IPv4:

> LISTEN tcp6 0 0 :::9200 :::\*

This should help:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Feb 4, 4:30 am, mrblue [john.agricola...@googlemail.com](mailto:john.agricola...@googlemail.com) wrote:

> Hi,
> 
> i decided to set up a dedicated server just for elasticsearch (debian  
> 6.0 squeeze 64 lamp). ES works fine so far, but i can´t connect to it  
> from another server.
> 
> Here is a very simple example:
> 
> $ch = curl\_init();  
> //curl\_setopt($ch, CURLOPT\_URL, "[http://localhost:9200/alle\_uhren/](http://localhost:9200/alle_uhren/)  
> \_search?pretty=true");
> 
> curl\_setopt($ch, CURLOPT\_URL, "[http://xxx.x.xxx.xxx:9200/xxxx/\_search](http://xxx.x.xxx.xxx:9200/xxxx/_search)?  
> pretty=true");
> 
> curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);  
> curl\_setopt($ch, CURLOPT\_POST, true);
> 
> $data = '{  
> "query" : {  
> "match\_all" : { }  
> },"size" : "2000"
> 
> }';
> 
> curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data);  
> $jason\_output = curl\_exec($ch);  
> $info = curl\_getinfo($ch);  
> curl\_close($ch);
> 
> print\_r($jason\_output);
> 
> It works fine with localhost, but not from a different server. I can  
> ping from one server to the other.  
> Here is what netstat says, there seems to be somthing on 9200, but i  
> know nothing about these kind of things 😉
> 
> tcp 0 0 127.0.0.1:3306 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 0.0.0.0:10000 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 0.0.0.0:80 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 0.0.0.0:22 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 127.0.0.1:25 0.0.0.0:\*  
> LISTEN  
> tcp 0 0 127.0.0.1:32000 0.0.0.0:\*  
> LISTEN  
> tcp6 0 0 :::9200 :::\*  
> LISTEN  
> tcp6 0 0 :::9300 :::\*  
> LISTEN  
> tcp6 0 0 :::21 :::\*  
> LISTEN  
> tcp6 0 0 :::22 :::\*  
> LISTEN  
> tcp6 0 0 ::1:25 :::\*  
> LISTEN
> 
> Any help is apreciated !

---

<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 6, 2017, 3:40am UTC](https://discuss.elastic.co/t/can-t-connect-to-dedicated-serach-server/6591/5 "2017-07-06T03:40:38Z")

</div>


