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 ".