linux命令檢查網絡問題使用的一般方法:
下面以 https://api.weixin.qq.com 為例測試liunux 服務器是否連通
- 首先考慮使用ping 域名檢查網絡:ping api.weixin.qq.com
[root@localhost ~]# ping api.weixin.qq.com PING api.weixin.qq.com (183.57.48.62) 56(84) bytes of data. ^C --- api.weixin.qq.com ping statistics --- 3 packets transmitted, 0 received, 100% packet loss, time 1999ms [root@localhost ~]#
結果並沒看到聯通,換種方式再試一次
- 使用curl 域名檢查網絡:curl api.weixin.qq.com
[root@localhost ~]# curl api.weixin.qq.com curl: (7) Failed connect to api.weixin.qq.com:80; Connection refused
結果也沒看到聯通,可能服務器已被禁ping,考慮使用telnet分析
- 使用nslookup 分析api.weixin.qq.com域名情況
[root@localhost ~]# nslookup api.weixin.qq.com Server: 114.114.114.114 Address: 114.114.114.114#53 Non-authoritative answer: Name: api.weixin.qq.com Address: 183.57.48.62 Name: api.weixin.qq.com Address: 183.3.234.152
使用telnet分析 網絡情況
[root@localhost ~]# telnet 183.57.48.62 443 Trying 183.57.48.62... Connected to 183.57.48.62. Escape character is '^]'.
可以連接,證明網絡是通的,在手機上測試確實可以訪問微信,證明網絡沒有問題