CentOS6下一次网络ping包没回应的故障分析

简介:
+关注继续查看

1)现象描述

  今天有同事访问,他在用vmware workstation做测试的时候,使用nat模式,在家里能够ping通www.baidu.com,但是在公司怎么ping都不通,但是访问内网和网关都正常。并且测试机的selinux和iptables都是已经关闭。


2)处理过程

a、测试到内网其它主机

1
2
3
4
5
6
7
8
9
10
11
[root@mysql-master ~]# ping -c 5 10.10.10.1
PING 10.10.10.1 (10.10.10.1) 56(84) bytes of data.
64 bytes from 10.10.10.1: icmp_seq=1 ttl=64 time=0.440 ms
64 bytes from 10.10.10.1: icmp_seq=2 ttl=64 time=0.968 ms
64 bytes from 10.10.10.1: icmp_seq=3 ttl=64 time=3.39 ms
64 bytes from 10.10.10.1: icmp_seq=4 ttl=64 time=4.77 ms
64 bytes from 10.10.10.1: icmp_seq=5 ttl=64 time=1.55 ms
--- 10.10.10.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 0.440/2.226/4.777/1.618 ms
说明:到内网其它主机,正常

b、测试到网关

1
2
3
4
5
6
7
8
[root@mysql-master ~]# ping -c 5 10.10.10.2
PING 10.10.10.2 (10.10.10.2) 56(84) bytes of data.
64 bytes from 10.10.10.2: icmp_seq=1 ttl=128 time=1.15 ms
64 bytes from 10.10.10.2: icmp_seq=2 ttl=128 time=2.21 ms
64 bytes from 10.10.10.2: icmp_seq=3 ttl=128 time=0.252 ms
64 bytes from 10.10.10.2: icmp_seq=4 ttl=128 time=0.209 ms
64 bytes from 10.10.10.2: icmp_seq=5 ttl=12
说明:到网关正常

c、测试到baidu.com的连通性

1
2
3
4
5
[root@mysql-master ~]# ping -c 5 www.baidu.com
PING www.a.shifen.com (61.135.169.121) 56(84) bytes of data.
--- www.a.shifen.com ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 13999ms
说明:发现包完全丢失,但是dns能够解析到ip地址,对网络是不是有限制产生了怀疑?

d、检测dns的解析

1
2
3
4
5
6
7
8
9
10
[root@mysql-master ~]# nslookup www.baidu.com
Server:10.10.10.2
Address:10.10.10.2#53
Non-authoritative answer:
www.baidu.comcanonical name = www.a.shifen.com.
Name:www.a.shifen.com
Address: 61.135.169.125
Name:www.a.shifen.com
Address: 61.135.169.121
说明:DNS解析正常

e、测试网络是否真的连通(wget以及nmap)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@mysql-master ~]# mkdir -p /packet
[root@mysql-master ~]# cd /packet/
[root@mysql-master packet]# wget www.baidu.com
--2016-10-19 06:01:48--  http://www.baidu.com/
正在解析主机 www.baidu.com... 61.135.169.125, 61.135.169.121
正在连接 www.baidu.com|61.135.169.125|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2381 (2.3K) [text/html]
正在保存至: “index.html”
100%[==================================================================================>] 2,381       --.-K/s   in 0s      
2016-10-19 06:01:48 (128 MB/s) - 已保存 “index.html” [2381/2381])
[root@mysql-master packet]# echo $?
0
测试表明wget是正常的,能够正常下载
[root@mysql-master packet]# nmap www.baidu.com
Starting Nmap 5.51 ( http://nmap.org ) at 2016-10-19 06:02 CST
Nmap scan report for www.baidu.com (61.135.169.125)
Host is up (0.036s latency).
Other addresses for www.baidu.com (not scanned): 61.135.169.121
Not shown: 998 filtered ports
PORT    STATE SERVICE
80/tcp  open  http
443/tcp open  https
Nmap done: 1 IP address (1 host up) scanned in 56.33 seconds
说明:能够使用nmap检测到端口开放的情况

f、利用tcpdump进行抓包分析

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[root@mysql-master ~]# ping -c 5 10.10.10.2
PING 10.10.10.2 (10.10.10.2) 56(84) bytes of data.
64 bytes from 10.10.10.2: icmp_seq=1 ttl=128 time=0.287 ms
64 bytes from 10.10.10.2: icmp_seq=2 ttl=128 time=0.626 ms
64 bytes from 10.10.10.2: icmp_seq=3 ttl=128 time=0.370 ms
64 bytes from 10.10.10.2: icmp_seq=4 ttl=128 time=0.412 ms
64 bytes from 10.10.10.2: icmp_seq=5 ttl=128 time=0.248 ms
--- 10.10.10.2 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4003ms
rtt min/avg/max/mdev = 0.248/0.388/0.626/0.133 ms
[root@mysql-master ~]# tcpdump -i eth0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
05:48:57.350869 IP mysql-master > localhost: ICMP echo request, id 10786, seq 1, length 64
05:48:57.351123 IP localhost > mysql-master: ICMP echo reply, id 10786, seq 1, length 64
05:48:58.352296 IP mysql-master > localhost: ICMP echo request, id 10786, seq 2, length 64
05:48:58.352889 IP localhost > mysql-master: ICMP echo reply, id 10786, seq 2, length 64
05:48:59.352281 IP mysql-master > localhost: ICMP echo request, id 10786, seq 3, length 64
05:48:59.352590 IP localhost > mysql-master: ICMP echo reply, id 10786, seq 3, length 64
05:49:00.353060 IP mysql-master > localhost: ICMP echo request, id 10786, seq 4, length 64
05:49:00.353433 IP localhost > mysql-master: ICMP echo reply, id 10786, seq 4, length 64
05:49:01.353288 IP mysql-master > localhost: ICMP echo request, id 10786, seq 5, length 64
05:49:01.353503 IP localhost > mysql-master: ICMP echo reply, id 10786, seq 5, length 64

说明:有正常的request包和reply,说明本机到10.10.10.2正常(request包),并且10.10.10.2到本机有回应(reply包)

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@mysql-master ~]# ping -c 5 www.baidu.com
PING www.a.shifen.com (61.135.169.125) 56(84) bytes of data.
--- www.a.shifen.com ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 14003ms
[root@mysql-master ~]# tcpdump -i eth0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
05:53:27.820920 IP mysql-master > 61.135.169.125: ICMP echo request, id 14370, seq 1, length 64
05:53:28.822483 IP mysql-master > 61.135.169.125: ICMP echo request, id 14370, seq 2, length 64
05:53:29.823843 IP mysql-master > 61.135.169.125: ICMP echo request, id 14370, seq 3, length 64
05:53:30.823290 IP mysql-master > 61.135.169.125: ICMP echo request, id 14370, seq 4, length 64
05:53:31.823680 IP mysql-master > 61.135.169.125: ICMP echo request, id 14370, seq 5, length 64
说明:发现有request包,表明本机到baidu的包,baidu是接收到的,可能是百度没响应(可能性不大)或者被公司防火墙阻断了

使用手机热点,共享给测试机使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@mysql-master ~]# ping -c 5 www.baidu.com
PING www.a.shifen.com (183.232.231.173) 56(84) bytes of data.
64 bytes from 183.232.231.173: icmp_seq=1 ttl=128 time=74.4 ms
64 bytes from 183.232.231.173: icmp_seq=2 ttl=128 time=74.7 ms
64 bytes from 183.232.231.173: icmp_seq=3 ttl=128 time=64.4 ms
64 bytes from 183.232.231.173: icmp_seq=4 ttl=128 time=57.0 ms
64 bytes from 183.232.231.173: icmp_seq=5 ttl=128 time=60.5 ms
--- www.a.shifen.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4065ms
rtt min/avg/max/mdev = 57.081/66.263/74.772/7.216 ms
[root@mysql-master ~]# tcpdump -i eth0 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
05:58:31.031646 IP mysql-master > 183.232.231.173: ICMP echo request, id 40226, seq 1, length 64
05:58:31.106104 IP 183.232.231.173 > mysql-master: ICMP echo reply, id 40226, seq 1, length 64
05:58:32.032448 IP mysql-master > 183.232.231.173: ICMP echo request, id 40226, seq 2, length 64
05:58:32.107194 IP 183.232.231.173 > mysql-master: ICMP echo reply, id 40226, seq 2, length 64
05:58:33.034464 IP mysql-master > 183.232.231.173: ICMP echo request, id 40226, seq 3, length 64
05:58:33.098846 IP 183.232.231.173 > mysql-master: ICMP echo reply, id 40226, seq 3, length 64
05:58:34.035272 IP mysql-master > 183.232.231.173: ICMP echo request, id 40226, seq 4, length 64
05:58:34.092322 IP 183.232.231.173 > mysql-master: ICMP echo reply, id 40226, seq 4, length 64
05:58:35.036289 IP mysql-master > 183.232.231.173: ICMP echo request, id 40226, seq 5, length 64
05:58:35.096837 IP 183.232.231.173 > mysql-master: ICMP echo reply, id 40226, seq 5, length 64
说明:到baidu是有request和reply包,进出的包都是正常的

综合分析:应该是公司内部网络时对回来的网络包做了些限制,随后与网络工程师核对了下,的确在防火墙上做了些限制。










本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1865812,如需转载请自行联系原作者
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
3月前
|
安全 测试技术 网络安全
Centos7x设置服务器禁ping【实用】
一定程度上在互联网上隐藏自己防止一些批量扫描软件探测主机,减少被入侵的几率。 对于正常运营的生产环境,稳定性是第一要素,同时也要做好相应的安全防护,关闭ping可以起到防止洪水攻击以及一定程度上隐藏自己防止一些批量扫描软件探测主机,减少被入侵的几率。
79 0
Centos7x设置服务器禁ping【实用】
|
5月前
|
网络协议 Linux 网络安全
如何解决IP能ping通但无法上网的问题?
如何解决IP能ping通但无法上网的问题?
834 0
|
10月前
|
缓存 网络协议 网络架构
网络基础:Ping、Traceroute应用与排错
网络基础:Ping、Traceroute应用与排错
197 0
网络基础:Ping、Traceroute应用与排错
|
10月前
|
JSON 数据可视化 Unix
CentOS下网络路由追踪软件mtr及besttrace
CentOS下网络路由追踪软件mtr及besttrace
846 0
CentOS下网络路由追踪软件mtr及besttrace
|
10月前
|
Linux 网络安全 Windows
CentOs主机能够ping通虚拟机,虚拟机无法ping通主机 解决方案
CentOs主机能够ping通虚拟机,虚拟机无法ping通主机 解决方案
CentOs主机能够ping通虚拟机,虚拟机无法ping通主机 解决方案
|
10月前
|
虚拟化
VMware虚拟机和主机互相ping不通排查以及解决
VMware虚拟机和主机互相ping不通排查以及解决
VMware虚拟机和主机互相ping不通排查以及解决
|
Linux 虚拟化
centos7 无法连接网络
centos7 无法连接网络
74 0
centos7 无法连接网络
|
Linux 数据安全/隐私保护
centOS 7无法连接网络详细解决办法
centOS 7无法连接网络详细解决办法
578 0
centOS 7无法连接网络详细解决办法
|
Linux
虚拟机centos7无法ping通百度
虚拟机centos7无法ping通百度
475 0
相关产品
云迁移中心
推荐文章
更多