在家里经常会搜一些技术文档,但是很多技术文档都是在简书上的。而家里的网络无法打开简书。今天彻底跟进下、看具体什么问题造成的无法打开?当然浏览器下是无法打开的。浏览器下的打开报错如下
怀疑过DNS解析的问题,所以先修改了DNS分别去访问,还是问题依然所以首先尝试命令行下访问测试:
➜ ~ curl -I http://www.jianshu.com
HTTP/1.1 301 Moved Permanently
Date: Tue, 20 Oct 2020 12:44:51 GMT
Content-Type: text/html
Content-Length: 278
Connection: keep-alive
Location: https://www.jianshu.com/
从上面结果来看是默认跳转到https的,这次访问https页面测试、他是报错无法打开。
➜ ~ curl -I https://www.jianshu.com
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to www.jianshu.com:443
查看客户端到服务器之间的网络情况。也没有问题,都是OK的
➜ ~ ping -c 5 www.jianshu.com
PING www.jianshu.com (47.92.108.93): 56 data bytes
64 bytes from 47.92.108.93: icmp_seq=0 ttl=51 time=36.588 ms
64 bytes from 47.92.108.93: icmp_seq=1 ttl=51 time=36.466 ms
64 bytes from 47.92.108.93: icmp_seq=2 ttl=51 time=32.454 ms
64 bytes from 47.92.108.93: icmp_seq=3 ttl=51 time=36.610 ms
64 bytes from 47.92.108.93: icmp_seq=4 ttl=51 time=36.272 ms
--- www.jianshu.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 32.454/35.678/36.610/1.616 ms
对获取的IP进行探测:
➜ ~ sudo nmap -sT 47.92.108.93
Starting Nmap 7.91 ( https://nmap.org ) at 2020-10-20 20:47 CST
Nmap scan report for 47.92.108.93
Host is up (0.034s latency).
Not shown: 998 filtered ports
PORT STATE SERVICE
80/tcp open http
443/tcp open https
也就是开放了80和443端口
再看下客户端到服务器之间的路由路径。
sudo mtr 47.92.108.93 |nali
sudo mtr www.jianshu.com
IPv6??
➜ ~ sudo mtr www.baidu.com 这个域名可以正常解析。
难道是不支持IPv6?
查看下我的Wi-Fi配置,我的本地IP地址自动获取到了IPV6的地址。
直接可以这里关闭,或者
networksetup -setv6off Wi-Fi
操作之后再次测试
➜ ~ curl -I https://www.jianshu.com
HTTP/1.1 200 OK
Server: Tengine
Date: Tue, 20 Oct 2020 13:08:01 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
ETag: W/"65f7c787bb0157e53cc028949950c5a5"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: locale=zh-CN; path=/
X-Request-Id: 6dd8b96d-331e-4d1a-a8e3-57b2ec830021
X-Runtime: 0.003816
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
搞定。究其原因原来是IPV6造成的。