LoginSignup
3
1

More than 5 years have passed since last update.

OpenSSHでポート番号を間違えたら、Connection refusedではなくNo route to hostになる

Posted at

ポート番号を間違える

…と、TCPのRSTをフィルタしていない場合、Connection refusedですよねぇ。

$ ssh -p 24 foo.example.com
ssh: connect to host foo.example.com port 24: Connection refused

ところが、時々、

$ ssh -p 24 bar.example.com
ssh: connect to host bar.example.com port 24: No route to host

となるんですよ。なんで? なんでなの??
tcpdumpしても、どちらもTCPのRSTが来ているだけで、全く差が無いのに…。

答え

$ telnet bar.example.com 24
Trying 192.0.2.1...
telnet: connect to address 192.0.2.1: Connection refused
Trying 2001:db8::1...
telnet: connect to address 2001:db8::1: No route to host
telnet: Unable to connect to remote host

AAAAあるのにv6が来ていない時、OpenSSHは、最後のエラーだけを表示している模様。
telnetは、途中経過も表示してくれるのね。

参考文献

本題と全然関係ない、ドキュメント用IPアドレスとドメイン名について書かれている、RFC6890RFC2606

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1