"Connection refused" vs "No route to host"

Source: Internet
Author: User

Once in http://blog.csdn.net/bisal/article/details/42496583 this blog post mentions the authentication of a port connection:

“[email protected] $telnet172.101.19.571521
Trying172.101.19.57...
Telnet:connect to address172.101.19.57: No route to host
if the port is not open, the actual error:
[email protected] $telnet 172.27.19.56 1521
Trying 172.27.19.56 ...
Telnet:connect to address 172.27.19.56:Connection refused
is not the firewall problem???
To shut down the firewall from the database server:
[[Email protected] ~]# service iptables stop
iptables:flushing Firewall rules: [OK]
iptables:setting chains to policy Accept:nat mangle filter [OK]
iptables:unloading modules: [OK]
again from the remote machine execution:
[email protected] $telnet172.101.19.571521
Trying172.101.19.57...
Connected to172.101.19.57.
Escape character is ' ^] '.
indicates that the port is open and, more importantly, clear, is a firewall problem. ”


The difference between "Connection refused" and "No route to host" and the problem diagnosis method are explained by experiment .

first, there is a post on the internet to explain "Connection refused" vs "No route to Host" (http://superuser.com/questions/720851/ Connection-refused-vs-no-route-to-host):

    nothing is listening On 127.0.0.1:80 and 132.70.6.157:80
    Nothing was listening on *:80
    the Firewall is blocking the connection with REJECT
so check your Apache and iptables config.
No route to host ' refers to a network problem. It is a reply from the target machine. The
says "Connection refused" is the target host explicitly rejecting this connection, It is possible that the port does not start listening, or because of a firewall. "no route to host" could be a network problem, not a reply from the target host.


an experimental simulation :

Client Machine ip:172.1.1.1

Target Machine ip:172.1.2.1

1. One of the boot port 1521 from the client Telnet target, but no exceptions are added to the firewall.

From 172.1.1.1 telnet 172.1.2.1 1521, hint no route to host.

Trying 172.1.2.1...

Telnet:connect to address 172.1.2.1: No route to host

In the firewall configuration iptables add port 1521, Telnet is ok.

2. One of the ports that are not started listening from the client Telnet target machine

the 172.1.2.1 10001 port is not enabled, Netstat-an | grep 10001 does not exist.

from 172.1.1.1 telnet 172.1.2.1 10001, hint connection refused.

Trying 172.1.2.1 ...

Telnet:connect to address 172.1.2.1:connection refused


conclusion : No route to host is the return of the firewall, first through the firewall, regardless of the port is not. Then if the firewall is passed, but the listener does not start, the connection refused error is prompted.

"Connection refused" vs "No route to host"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.