サーバと通信できない時に試すコマンド。
TCP
1 | nc -vz <host or ip_address> <port> |
具体例
1 2 3 4 5 6 7 8 | # 成功例 nc -vz www.google.com 80 Connection to www.google.com 80 port [tcp/http] succeeded! # 失敗例 nc -vz www.google.com 88 nc: connect to www.google.com port 88 (tcp) failed: Connection timed out nc: connect to www.google.com port 88 (tcp) failed: Network is unreachable |
UDP
1 | nc -uvz <host or ip_address> <port> |
ncコマンドがない時
yumやaptでインストールしてください。
1 | yum install nc |
<div class=”booklink-box” style=”text-align:left;padding-bottom:20px;font-size:small;/zoom: 1;overflow: hidden;”><div class=”booklink-image” style=”float:left;margin:0 15px 10px 0;”><a href=”http://www.amazon.co.jp/exec/obidos/asin/4797380942/ktykwsk01-22/”; target=”blank” ><img src=”https://images-fe.ssl-images-amazon.com/images/I/51GjYXdAPBL._SL160.jpg”; style=”border: none;” /></a></div><div class=”booklink-info” style=”line-height:120%;/zoom: 1;overflow: hidden;”><div class=”booklink-name” style=”margin-bottom:10px;line-height:120%”><a href=”http://www.amazon.co.jp/exec/obidos/asin/4797380942/ktykwsk01-22/”; target=”_blank” >新しいLinuxの教科書</a><div class=”booklink-powered-date” style=”font-size:8pt;margin-top:5px;font-family:verdana;line-height:120%”>posted with <a href=”https://yomereba.com”; rel=”nofollow” target=”_blank”>ヨメレバ</a></div></div><div class=”booklink-detail” style=”margin-bottom:5px;”>大角 祐介 SBクリエイティブ 2015-06-06 </div><div class=”booklink-link2″ style=”margin-top:10px;”><div class=”shoplinkamazon” style=”margin:5px 0″><a href=”http://www.amazon.co.jp/exec/obidos/asin/4797380942/ktykwsk01-22/”; target=”_blank” >Amazonで探す</a></div><div class=”shoplinkkindle” style=”margin:5px 0″><a href=”http://www.amazon.co.jp/exec/obidos/ASIN/B072K1NH76/ktykwsk01-22/”; target=”_blank” >Kindleで探す</a></div><div class=”shoplinkrakuten” style=”margin:5px 0″><a href=”https://hb.afl.rakuten.co.jp/hgc/15d7a146.1f786876.15d7a147.6db48089/?pc=http%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F13241689%2F%3Fscid%3Daf_ich_link_urltxt%26m%3Dhttp%3A%2F%2Fm.rakuten.co.jp%2Fev%2Fbook%2F”; target=”_blank” >楽天ブックスで探す</a></div> </div></div><div class=”booklink-footer” style=”clear: left”></div></div>
<div class=”booklink-box” style=”text-align:left;padding-bottom:20px;font-size:small;/zoom: 1;overflow: hidden;”><div class=”booklink-image” style=”float:left;margin:0 15px 10px 0;”><a href=”http://www.amazon.co.jp/exec/obidos/asin/4774174041/ktykwsk01-22/”; target=”blank” ><img src=”https://images-fe.ssl-images-amazon.com/images/I/51ZPkoBGdZL._SL160.jpg”; style=”border: none;” /></a></div><div class=”booklink-info” style=”line-height:120%;/zoom: 1;overflow: hidden;”><div class=”booklink-name” style=”margin-bottom:10px;line-height:120%”><a href=”http://www.amazon.co.jp/exec/obidos/asin/4774174041/ktykwsk01-22/”; target=”_blank” >[改訂第3版]Linuxコマンドポケットリファレンス</a><div class=”booklink-powered-date” style=”font-size:8pt;margin-top:5px;font-family:verdana;line-height:120%”>posted with <a href=”http://yomereba.com”; rel=”nofollow” target=”_blank”>ヨメレバ</a></div></div><div class=”booklink-detail” style=”margin-bottom:5px;”>沓名 亮典 技術評論社 2015-06-05 </div><div class=”booklink-link2″ style=”margin-top:10px;”><div class=”shoplinkamazon” style=”margin:5px 0″><a href=”http://www.amazon.co.jp/exec/obidos/asin/4774174041/ktykwsk01-22/”; target=”_blank” >Amazonで探す</a></div><div class=”shoplinkkindle” style=”margin:5px 0″><a href=”http://www.amazon.co.jp/exec/obidos/ASIN/B00Z5OCH1G/ktykwsk01-22/”; target=”_blank” >Kindleで探す</a></div><div class=”shoplinkrakuten” style=”margin:5px 0″><a href=”https://hb.afl.rakuten.co.jp/hgc/15d7a146.1f786876.15d7a147.6db48089/?pc=http%3A%2F%2Fbooks.rakuten.co.jp%2Frb%2F13256495%2F%3Fscid%3Daf_ich_link_urltxt%26m%3Dhttp%3A%2F%2Fm.rakuten.co.jp%2Fev%2Fbook%2F”; target=”_blank” >楽天ブックスで探す</a></div><div class=”shoplinkrakukobo” style=”margin:5px 0″><a href=”http://hb.afl.rakuten.co.jp/hgc/15d7a146.1f786876.15d7a147.6db48089/?pc=http%3A%2F%2Fbooks.rakuten.co.jp%2Frk%2F644b19a1027b3f558e34d6301247e9ae%2F%3Fscid%3Daf_ich_link_urltxt%26m%3Dhttp%3A%2F%2Fm.rakuten.co.jp%2Fev%2Fbook%2F”; target=”_blank” >楽天koboで探す</a></div> </div></div><div class=”booklink-footer” style=”clear: left”></div></div>
宮崎県在住。
プログラムを書いて暮らしています。趣味はルアーフィッシング、ギター。