LoginSignup
27
23

More than 5 years have passed since last update.

シェルで1行の疎通確認用簡易Webサーバ

Posted at

ネットワークの設定が正しいかを確認するため、疎通確認を行うのにWebサーバ等を入れずにコマンドだけで確認する方法。

1.簡易Webサーバを実行

疎通を確認したいサーバ上で実行
$ while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; echo 'HELLO'; } | nc -l 8000; done

2.疎通確認

疎通確認
$ curl http://疎通確認先サーバ:8000/
GET / HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
Host: XXXXXXXX:8000
Accept: */*

HELLO
27
23
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
27
23