28、排查网站问题
28.1、如何解决网站访问速慢的问题:
把自己当做用户去测试,如果没问题就从客户的角度去思考
如果有问题
ping网站
通,不丢包:
http服务的问题检查服务是否停了,服务cpu,io高(top),网站的端口(nmap wangzhi -p 80),防火墙,(curl www.baidu.com:相当于浏览器访问)
网站购买的带宽满了,通过流量监控查看
个别用户自身的问题,用户的线路和网站带宽的线路不符
通过url调试网站
数据库问题,存储服务器的问题
通, 丢包:
机房带宽不稳定,线路不稳定
不通:
traceroute -d www.baidu.com:排查各个路由节点
28.2、如何解决局域网内无法上网的问题:
ping
ping www.baidu.com
如果通:
可能是浏览器的原因;
如果不通, ping网关:
如果ping通了:检查dns是否正常
如果ping不通:ping其它主机
不通:查看ip设置,网卡驱动,物理链路
如果通:则可能是网关不让上网
辅助排查:
看其它人可能上网,ip地址冲突,arp病毒,交换机坏了,大面积上不了网
28.3、网络工具:
[root@centos6 ~]# tcpdump icmp #抓包工具
nmap:扫描工具
28.3.1、域名解析工具:
[root@centos6 ~]# host www.baidu.com
www.baidu.com is an alias for www.a.shifen.com.
www.a.shifen.com has address 115.239.211.112
www.a.shifen.com has address 115.239.210.27
[root@centos6 ~]# nslookup
> www.baidu.com
Server: 114.114.114.114
Address: 114.114.114.114#53
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 115.239.211.112
Name: www.a.shifen.com
Address: 115.239.210.27
28.4、dns域名解析过程:
[root@centos6 ~]# dig @8.8.8.8 www.baidu.com +trace
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6 <<>> @8.8.8.8 www.baidu.com +trace
; (1 server found)
;; global options: +cmd
. 194151 IN NS e.root-servers.net.
. 194151 IN NS a.root-servers.net.
. 194151 IN NS g.root-servers.net.
. 194151 IN NS h.root-servers.net.
. 194151 IN NS b.root-servers.net.
. 194151 IN NS l.root-servers.net.
. 194151 IN NS i.root-servers.net.
. 194151 IN NS d.root-servers.net.
. 194151 IN NS k.root-servers.net.
. 194151 IN NS f.root-servers.net.
. 194151 IN NS j.root-servers.net.
. 194151 IN NS c.root-servers.net.
. 194151 IN NS m.root-servers.net.
;; Received 228 bytes from 8.8.8.8#53(8.8.8.8) in 277 ms
com. 172800 IN NS a.gtld-servers.net.
com. 172800 IN NS b.gtld-servers.net.
com. 172800 IN NS c.gtld-servers.net.
com. 172800 IN NS d.gtld-servers.net.
com. 172800 IN NS e.gtld-servers.net.
com. 172800 IN NS f.gtld-servers.net.
com. 172800 IN NS g.gtld-servers.net.
com. 172800 IN NS h.gtld-servers.net.
com. 172800 IN NS i.gtld-servers.net.
com. 172800 IN NS j.gtld-servers.net.
com. 172800 IN NS k.gtld-servers.net.
com. 172800 IN NS l.gtld-servers.net.
com. 172800 IN NS m.gtld-servers.net.
;; Received 491 bytes from 199.7.91.13#53(199.7.91.13) in 537 ms
baidu.com. 172800 IN NS dns.baidu.com.
baidu.com. 172800 IN NS ns2.baidu.com.
baidu.com. 172800 IN NS ns3.baidu.com.
baidu.com. 172800 IN NS ns4.baidu.com.
baidu.com. 172800 IN NS ns7.baidu.com.
;; Received 201 bytes from 192.42.93.30#53(192.42.93.30) in 320 ms
www.baidu.com. 1200 IN CNAME www.a.shifen.com.
a.shifen.com. 1200 IN NS ns2.a.shifen.com.
a.shifen.com. 1200 IN NS ns1.a.shifen.com.
a.shifen.com. 1200 IN NS ns3.a.shifen.com.
a.shifen.com. 1200 IN NS ns5.a.shifen.com.
a.shifen.com. 1200 IN NS ns4.a.shifen.com.
;; Received 228 bytes from 220.181.37.10#53(220.181.37.10) in 36 ms