"Connection refused" vs "No route to host"

Source: Internet
Author: User
Tags iptables

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

"Ora10g@localhost.localdomain$telnet 172.101.19.57 1521
Trying 172.101.19.57 ...
Telnet:connect to address 172.101.19.57: No route to host
If the port is not open, the actual error:
Ora10g@localhost.localdomain$telnet 172.27.19.56 1521
Trying 172.27.19.56 ...
Telnet:connect to address 172.27.19.56: Connection refused
is not the problem of the firewall ...
To shut down a firewall from the database server:
[Root@dcsopen2node ~]# service iptables stop
iptables:flushing firewall rules: [OK]
Iptables:setting chains to policy Accept:nat mangle filter [OK]
iptables:unloading modules: [OK]
Then from the remote machine execution:
Ora10g@localhost.localdomain$telnet 172.101.19.571521
Trying 172.101.19.57 ...
Connected to 172.101.19.57.
Escape character is ' ^] '.
The port has been opened, more importantly, it is clear that the firewall problem . ”


The difference between "Connection refused" and "No route to host" is explained again through the experiment and the problem diagnosis is thought.

First, there is an online post stating "Connection refused" vs "No route to host" (http://superuser.com/questions/720851/ Connection-refused-vs-no-route-to-host):

"Connection refused" means that target machine actively rejected the Connection. With the port as the "context, one of the" following things is likely the reason:
The listening on 127.0.0.1:80 and 132.70.6.157:80
What is 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 isn't a reply from the target machine.
The word "Connection refused" is that the target host has explicitly rejected the connection, possibly that the port has not started listening, or because of the firewall. "No route to host" may be a network problem, not a response from the target host.


An experimental simulation:

Client Machine ip:172.1.1.1

Target Machine ip:172.1.2.1

1. A 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, prompt no route to host.

Trying 172.1.2.1 ...

Telnet:connect to address 172.1.2.1:no route to host

Iptables add 1521 ports in the firewall configuration, Telnet is OK.

2. A port that does not start listening from the client Telnet target

172.1.2.1 's 10001 ports are 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: It is indicated that no route to host is the return of the firewall, first through the firewall, regardless of the port. Then, if the firewall is passed, but the listener does not start, prompts connection refused error.

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.