# \`curl: (7) Failed connect to 187.48.456.45:9200; Connection refused\`

**URL:** <https://discuss.elastic.co/t/curl-7-failed-connect-to-187-48-456-45-9200-connection-refused/52821>\
**Category:** Elasticsearch\
**Created:** [June 15, 2016, 7:27am UTC](https://discuss.elastic.co/t/curl-7-failed-connect-to-187-48-456-45-9200-connection-refused/52821 "2016-06-15T07:27:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)\
**Post date:** [June 15, 2016, 7:27am UTC](https://discuss.elastic.co/t/curl-7-failed-connect-to-187-48-456-45-9200-connection-refused/52821/1 "2016-06-15T07:27:17Z")

</div>

Hi,  
I installed ES 2.3.3. on my server(centos 7). I want to work on server not localhost. So I changed my elasticsearch.yml file with my ip number:187.48.456.45:

network.host: `187.48.456.45`

After restart ES and I tried to connection.

```
[root@elasticsearch ~]# service elasticsearch restart
Restarting elasticsearch (via systemctl): [OK]

```

However It didn't work true.

[root@elasticsearch ~]# `curl http://187.48.456.45:9200`  
my error:  
`curl: (7) Failed connect to 187.48.456.45:9200; Connection refused`

Also my firewall close. What is the problem?

---

<div class="post-metadata">

**Author:** ![Kevin\_Csuka](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@Kevin\_Csuka](https://discuss.elastic.co/u/Kevin_Csuka)\
**Post date:** [June 15, 2016, 7:37am UTC](https://discuss.elastic.co/t/curl-7-failed-connect-to-187-48-456-45-9200-connection-refused/52821/2 "2016-06-15T07:37:15Z")

</div>

> [@Hilal](#):
>
> sticse

Yeah this is a network issue. I probably know how to solve it:  
On a Windows machine: Google for 'paping' and download it, put it in C:/  
Open up a command prompt and perform:

```auto
 C:/paping 176.56.236.46 -p 9200 
```

I'm guessing it will tell you it is closed.  
You say 'my firewall close'. This is not how firewalls work. When you 'shutdown' a firewall, it doesn't mean all the ports are open!  
CentOS 7 works with firewallcmd. You can either disable firewallcmd and use iptables to open a port.  
Or use these commands:

`firewall-cmd --zone=dmz --add-port=9200/tcp --permanent
systemctl restart firewall-cmd
`

And I'm not quite sure what it is you're trying. Because which machine is IP number: 187.48.456.45?  
And you're trying to curl @ 176.56.236.46:9200 (A different IP adres)

---

<div class="post-metadata">

**Author:** ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)\
**Post date:** [June 15, 2016, 12:09pm UTC](https://discuss.elastic.co/t/curl-7-failed-connect-to-187-48-456-45-9200-connection-refused/52821/3 "2016-06-15T12:09:11Z")

</div>

Ok I did but it isn't.

I installed centos 6 instead of centos 7. After I installed ES. 2.3.3.

I configured elasticsearch.yml for `network.host: 187.48.456.45.`  
After I installed vesta web panel for apache, mysql and php.

service elasticsearch restart.

```
error: permission denied on key 'vm.max_map_count'
Starting elasticsearch: log4j:WARN No appenders could be found for logger (common).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

```

I tried to connect on my server:

`curl 'http://187.48.456.45:9200'`  
...

```
{
  "name" : "Rogue",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.3.3",
    "build_hash" : "218bdf10790eef486ff2c41a3df5cfa32dadcfde",
    "build_timestamp" : "2016-05-17T15:40:04Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  },
  "tagline" : "You Know, for Search"
}

```

It work true .👍

However I tried to connection on my browser:

```
http://187.48.456.45:9200

```

Result:

```
This site can not be reached
187.48.456.45 took too long to respond to the main machine.
Make a search on Google on 187 48 9200
ERR_CONNECTION_TIMED_OUT

```

What can I do?

---

<div class="post-metadata">

**Author:** ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)\
**Post date:** [June 15, 2016, 12:11pm UTC](https://discuss.elastic.co/t/curl-7-failed-connect-to-187-48-456-45-9200-connection-refused/52821/4 "2016-06-15T12:11:33Z")

</div>

my ip tables:

```
...
-A INPUT -p tcp -m tcp --dport 9200 -j ACCEPT 
-A INPUT -p tcp -m udp --dport 9200 -j ACCEPT 
....

```

and

[root@elasticsearch ~]# `netstat -plnt`

```
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 3294/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 3294/dovecot
tcp 0 0 176.56.236.46:80 0.0.0.0:* LISTEN 4837/nginx
tcp 0 0 176.56.236.46:8080 0.0.0.0:* LISTEN 2583/httpd
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 3263/exim
tcp 0 0 127.0.0.1:8081 0.0.0.0:* LISTEN 2583/httpd
tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 6092/nginx
tcp 0 0 127.0.0.1:8084 0.0.0.0:* LISTEN 4837/nginx
tcp 0 0 176.56.236.46:53 0.0.0.0:* LISTEN 3177/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 3177/named
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 2622/vsftpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1285/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 3263/exim
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 3177/named
tcp 0 0 176.56.236.46:8443 0.0.0.0:* LISTEN 2583/httpd
tcp 0 0 0.0.0.0:2525 0.0.0.0:* LISTEN 3263/exim
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 3294/dovecot
tcp 0 0 0.0.0.0:995 0.0.0.0:* LISTEN 3294/dovecot
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3093/mysqld
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 3263/exim
tcp 0 0 ::ffff:176.56.236.46:9200 :::* LISTEN 8121/java
tcp 0 0 :::465 :::* LISTEN 3263/exim
tcp 0 0 ::ffff:176.56.236.46:9300 :::* LISTEN 8121/java
tcp 0 0 :::22 :::* LISTEN 1285/sshd
tcp 0 0 :::25 :::* LISTEN 3263/exim
tcp 0 0 ::1:953 :::* LISTEN 3177/named
tcp 0 0 :::2525 :::* LISTEN 3263/exim
tcp 0 0 :::587 :::* LISTEN 3263/exim
```

---

<div class="post-metadata">

**Author:** ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)\
**Post date:** [June 15, 2016, 1:26pm UTC](https://discuss.elastic.co/t/curl-7-failed-connect-to-187-48-456-45-9200-connection-refused/52821/5 "2016-06-15T13:26:18Z")

</div>

It was solved.

on server cmd:

```
/etc/init.d/elasticsearch start

```

after:

[http://176.56.236.46:9200](http://176.56.236.46:9200)

```
{
  "name" : "Bi-Beast",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.3.3",
    "build_hash" : "218bdf10790eef486ff2c41a3df5cfa32dadcfde",
    "build_timestamp" : "2016-05-17T15:40:04Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  },
  "tagline" : "You Know, for Search"
}
```

---

<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 5, 2017, 10:43pm UTC](https://discuss.elastic.co/t/curl-7-failed-connect-to-187-48-456-45-9200-connection-refused/52821/6 "2017-07-05T22:43:39Z")

</div>


