快速测试端口的连通性(HTTP/HTTPS)

ping

仅限 80 端口,命令中无法指定端口:

C:\Users\Administrator>ping kikakika.com
遗失对主机的连接。
正在 Ping kikakika.com [111.231.221.219] 具有 32 字节的数据:
来自 111.231.221.219 的回复: 字节=32 时间=38ms TTL=52
来自 111.231.221.219 的回复: 字节=32 时间=38ms TTL=52
来自 111.231.221.219 的回复: 字节=32 时间=38ms TTL=52
来自 111.231.221.219 的回复: 字节=32 时间=38ms TTL=52

111.231.221.219Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 38ms,最长 = 38ms,平均 = 38ms

注意,ping 命令只能用于域名或 IP 地址,无法指定协议或 URI:

C:\Users\Administrator>ping baidu.com/a
Ping 请求找不到主机 baidu.com/a。请检查该名称,然后重试。

C:\Users\Administrator>ping http://baidu.com
Ping 请求找不到主机 http://baidu.com。请检查该名称,然后重试。

C:\Users\Administrator>ping baidu.com

正在 Ping baidu.com [220.181.57.216] 具有 32 字节的数据:
来自 220.181.57.216 的回复: 字节=32 时间=34ms TTL=55
来自 220.181.57.216 的回复: 字节=32 时间=37ms TTL=55
来自 220.181.57.216 的回复: 字节=32 时间=34ms TTL=55
来自 220.181.57.216 的回复: 字节=32 时间=33ms TTL=55

220.181.57.216Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 33ms,最长 = 37ms,平均 = 34ms

C:\Users\Administrator>ping 220.181.57.216

正在 Ping 220.181.57.216 具有 32 字节的数据:
来自 220.181.57.216 的回复: 字节=32 时间=34ms TTL=55
来自 220.181.57.216 的回复: 字节=32 时间=34ms TTL=55
来自 220.181.57.216 的回复: 字节=32 时间=34ms TTL=55
来自 220.181.57.216 的回复: 字节=32 时间=34ms TTL=55

220.181.57.216Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
    最短 = 34ms,最长 = 34ms,平均 = 34ms

Telnet

Windows 默认安装了 Telnet,通过终端直接使用即可。如果连接成功,会进入会话,回车退出:

C:\Users\Administrator>telnet xxxxxx.com.cn 443
HTTP/1.1 400 Bad Request
Server: nginx/1.14.0
Date: Wed, 30 May 2018 05:43:01 GMT
Content-Type: text/html
Content-Length: 173
Connection: close

<html>
<head><title>400 Bad Requesttitle>head>
<body bgcolor="white">
<center><h1>400 Bad Requesth1>center>
<hr><center>nginx/1.14.0center>
body>
html>

遗失对主机的连接。

连接失败则直接退出:

C:\Users\Administrator>telnet xxxxxx.com 443
正在连接xxxxxx.com...无法打开到主机的连接。 在端口 443: 连接失败

C:\Users\Administrator>telnet 222.66.184.166 443
正在连接222.66.184.166...无法打开到主机的连接。 在端口 443: 连接失败

OpenSSL

Linux 默认安装了 OpenSSL,可以顺便查看证书等一系列信息:

[root@VM_139_74_centos gogs]# openssl s_client -connect xxxxxx.com.cn:443
^[[A^C
[root@VM_139_74_centos gogs]# openssl s_client -connect github.com:443
CONNECTED(00000003)
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert High Assurance EV Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert SHA2 Extended Validation Server CA
verify return:1
depth=0 businessCategory = Private Organization, jurisdictionC = US, jurisdictionST = Delaware, serialNumber = 5157550, C = US, ST = California, L = San Francisco, O = "GitHub, Inc.", CN = github.com
verify return:1
---
Certificate chain
 0 s:/businessCategory=Private Organization/jurisdictionC=US/jurisdictionST=Delaware/serialNumber=5157550/C=US/ST=California/L=San Francisco/O=GitHub, Inc./CN=github.com
   i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA
 1 s:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA
   i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIHQjCCBiqgAwIBAgIQCgYwQn9bvO1pVzllk7ZFHzANBgkqhkiG9w0BAQsFADB1
...
WUjbST4VXmdaol7uzFMojA4zkxQDZAvF5XgJlAFadfySna/teik=
-----END CERTIFICATE-----
subject=/businessCategory=Private Organization/jurisdictionC=US/jurisdictionST=Delaware/serialNumber=5157550/C=US/ST=California/L=San Francisco/O=GitHub, Inc./CN=github.com
issuer=/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 3582 bytes and written 415 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-GCM-SHA256
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES128-GCM-SHA256
    Session-ID: ADECBAA5DC14DE0AF455B6185D75C2BDDD78707F7EFFDE90F94883F94926ED41
    Session-ID-ctx: 
    Master-Key: B3C82BAA99C0C8AC07DB9C50574ADD3F157E86E8A733AE95C37B6B62B281408C67E458C45BDE6C30E01D0CAA52424651
    Key-Arg   : None
    Krb5 Principal: None
    PSK identity: None
    PSK identity hint: None
    Start Time: 1527584527
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---
closed
[root@VM_139_74_centos gogs]#

转载于:https://www.cnblogs.com/kika/p/10851592.html

你可能感兴趣的:(操作系统,php,网络)