netcatコマンドが開いているポートにアクセスできません。

netcatコマンドが開いているポートにアクセスできません。

一部のソフトウェアをインストールしようとしているサーバーが2台あります。 1つはserver1(IP 10.1.2.205)、もう1つはserver2(IP 10.1.2.206)です。どちらも名前とIPアドレスで互いにpingできます(たとえば、server2ping server1またはで互いにpingできますping 10.1.2.205)。

netstat -lntserver1に入力すると、次の結果が表示されます。

    Proto Recv-Q Send-Q Local Address ForeignAddress State  
    tcp        0      0 0.0.0.0:111    0.0.0.0:*     LISTEN 
    tcp        0      0 0.0.0.0:22     0.0.0.0:*     LISTEN 
    tcp        0      0 127.0.0.1:631  0.0.0.0:*     LISTEN 
    tcp        0      0 127.0.0.1:25   0.0.0.0:*     LISTEN 
    tcp        0      0 0.0.0.0:52666  0.0.0.0:*     LISTEN 
    tcp        0      0 0.0.0.0:6817   0.0.0.0:*     LISTEN 
    tcp        0      0 0.0.0.0:6818   0.0.0.0:*     LISTEN 
    tcp        0      0 0.0.0.0:5672   0.0.0.0:*     LISTEN 
    tcp        0      0 :::111         :::*          LISTEN 
    tcp        0      0 :::22          :::*          LISTEN 
    tcp        0      0 ::1:631        :::*          LISTEN 
    tcp        0      0 :::36483       :::*          LISTEN 
    tcp        0      0 :::5989        :::*          LISTEN  

server2でnetcatコマンドを使用しようとすると、次の結果が表示されます。

nc -v 10.1.2.205 22
Connection to server1 22 port [tcp/ssh] succeeded! SSH-2.0-OpenSSH_5.3

nc -v server1 22
Connection to server1 22 port [tcp/ssh] succeeded! SSH-2.0-OpenSSH_5.3

しかし、問題は次のような出力です。
nc -v server1 5989
nc: connect to server1 port 5989(tcp) failed: No route to host
他のすべてのポートで同じ応答を取得します。
server1では、他のポートは応答しません。私が興味のあるポートはポート6817と6818です。 2台のコンピュータ間のポートでリッスンして応答する必要があるアプリケーションがあります。

出力:iptables -L

    Chain INPUT (policy ACCEPT)
    target  prot opt source   destination         
    ACCEPT  all  --  anywhere anywhere  state RELATED,ESTABLISHED           
    ACCEPT  icmp --  anywhere anywhere            
    ACCEPT  all  --  anywhere anywhere            
    ACCEPT  tcp  --  anywhere anywhere  state NEW tcp dpt:ssh 
    REJECT  all  --  anywhere anywhere  reject-with icmp-host-prohibited 

    Chain FORWARD (policy ACCEPT)
    target  prot opt source   destination         
    REJECT  all  --  anywhere anywhere    reject-with icmp-host-prohibited 

    Chain OUTPUT (policy ACCEPT)
    target  prot opt source   destination    

何が間違っている可能性がありますか?

ベストアンサー1

Centosを使っているようです。 iptables ルールが示すように、ポート 22 を除くすべての TCP 接続がブロックされます。

以下でiptablesルールを更新してみてください。

$ sudo iptables -F

これにより、すべてのiptablesルールが削除されます。これがうまくいくかどうか教えてください。

おすすめ記事