NETWORK ENGINEER BLOG

Tips and Reviews for Engineers

Telnet を使用した HTTP/MAIL 確認方法

HTTP 確認方法

Telnet を使用して、Web サイトへアクセスします。

# telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.localcomain (127.0.0.1).
Escape character is '^]'.
GET http://localhost/index.html HTTP/1.0

HTTP/1.1 200 OK
Date: Fri, 21 Feb 2014 02:43:08 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Fri, 21 Feb 2014 02:28:46 GMT
ETag: "30313-5-4f2e1619bb380"
Accept-Ranges: bytes
Content-Length: 5
Connection: close
Content-Type: text/html; charset=UTF-8

test
Connection closed by foreign host.

プロキシの試験も可能です。

# telnet localhost 3128
Trying 127.0.0.1...
Connected to localhost.localcomain (127.0.0.1).
Escape character is '^]'.
GET http://192.168.1.152/index.html HTTP/1.0

HTTP/1.0 200 OK
Date: Fri, 21 Feb 2014 11:28:36 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Fri, 21 Feb 2014 02:34:11 GMT
ETag: "1502d2-5-4f2e174facec0"
Accept-Ranges: bytes
Content-Length: 5
Content-Type: text/html; charset=UTF-8
Age: 1344
X-Cache: HIT from myhost
X-Cache-Lookup: HIT from myhost:3128
Via: 1.0 myhost:3128 (squid/2.6.STABLE21)
Proxy-Connection: close

test
Connection closed by foreign host.

アクセスログから、プロキシ経由となっている事を確認します。

# tail -f /var/log/squid/access.log
1392982116.127    918 127.0.0.1 TCP_MISS/200 385 GET http://192.168.1.152/index.html - DIRECT/192.168.1.152 text/html
1392982262.706    179 127.0.0.1 TCP_HIT/200 393 GET http://192.168.1.152/index.html - NONE/- text/html
MAIL 確認方法

Telnet を使用して、メールを送信します。

# telnet localhost smtp
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 host01.example.com ESMTP
HELO TEST
250 host01.example.com
MAIL FROM:user01@example.com
250 2.1.0 Ok
RCPT TO:user02@exmaple.com
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
subject:testmail
this is testmail.
.
250 2.0.0 Ok: queued as DD8DC4400B2
QUIT
221 2.0.0 Bye
Connection closed by foreign host.