LoginSignup
1
2

More than 5 years have passed since last update.

サーバ間で通信できるのか疎通確認する

Posted at

クラウドサービスでセキュリティグループ付け替えなど、ネットワークとポート開放に漏れないことを確認する場合のコマンド

ポートがLISTEN済みの場合

$ telnet <hostname> <port>
Escape character is '^]'

ポートをLISTENしていない場合

ncで一時的にポートをLISTEN、テスト用文字列を返す

(例)ポートLISTENしていない状態で接続に行く
(それ以外でも、特定ホストのみ許可など接続の制御をしている場合なども含みます。)

$ telnet <hostname> <port>
Connection refused

送信先サーバ(destination)

$ echo "receive `hostname`" |  nc -l <port>

送信元サーバ(source)

$ telnet <hostname> <port>
Escape character is '^]'.
receive hostname
1
2
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
1
2