Reason and solution for a port in linux rejecting remote host connection

Source: Internet
Author: User

Reason and solution for a port in linux rejecting remote host connection
Reason for a port in linux rejecting remote host connection and solution Description: for example, port 9000 from the local telent to the host 192.168.8.170 is rejected. [Zhu @ hadoop log] $ telnet 192.168.8.170 9000
Trying 192.168.8.170...
Telnet: connect to address 192.168.8.170: Connection refused reason: there are two reasons
One is intercepted by the firewall.
Or the listening address of this port is the local machine (127.0.0.1). In this case, only access to the port initiated from the local machine is allowed, and access to the external host is denied. You can run the "netstat-anp | grep 9000" command to view the listening address of the port: [zhu @ hadoop log] $ netstat-anp | grep 9000

(Not all processes cocould be identified, non-owned process info will not be shown, you wowould have to be root to see it all .) tcp 0 0: ffff: 127.0.0.1: 9000: * LISTEN 6614/java tcp 0: ffff: 127.0.0.1: 46722: ffff: 127.0.0.1: 9000 TIME_WAIT-tcp 0 0: ffff: 127.0.0.1: 46729: ffff: 127.0.0.1: 9000 TIME_WAIT-tcp 0 0: ffff: 127.0.0.1: 46723: ffff: 127.0.0.1: 9000 ESTABLISHED 6733/java tcp 0: ffff: 127.0.0.1: 46726: ffff: 127.0.0.1: 9000 TIME_WAIT-tcp 0 0: ffff: 127.0.0.1: 46730: ffff: 127.0.0.1: 9000 ESTABLISHED 6976/java tcp 0: ffff: 127.0.0.1: 9000: ffff: 127.0.0.1: 46730 ESTABLISHED 6614/java tcp 0 0: ffff: 127.0.0.1: 9000: ffff: wagner. 0.0.1: 46723 ESTABLISHED 6614/java
We can see that the address of port 9000 listening is a local address (127.0.0.1)
Solution:
If the firewall filters requests to access the port, it sets a filter rule to allow the port or disable the firewall.
If the listening address is the local address, modify the listening address to the real IP address (for example, 192.168.8.119 ). For example, in hadoop, you can change the local address (eg: localhost --> hadoop) and add the ing between the host hadoop and ip 192.168.8.119 to the/etc/hosts configuration file, then modify fs. default. the value of name is "hdfs: // hadoop: 9000 ".

 

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.