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

1)现象描述

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

2)处理过程

a、测试到内网其它主机

[[email protected] ~]# 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、测试到网关

[[email protected] ~]# 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的连通性

[[email protected] ~]# 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的解析

[[email protected] ~]# 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)

[[email protected] ~]# mkdir -p /packet
[[email protected] ~]# cd /packet/
[[email protected] 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])
[[email protected] packet]# echo $?
0
测试表明wget是正常的,能够正常下载
[[email protected] 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进行抓包分析

[[email protected] ~]# 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
[[email protected] ~]# 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包)

[[email protected] ~]# 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
[[email protected] ~]# 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是接收到的,可能是百度没响应(可能性不大)或者被公司防火墙阻断了

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

[[email protected] ~]# 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
[[email protected] ~]# 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包,进出的包都是正常的

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

时间: 2024-07-31 14:32:43

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

ping不通,找房东-----从一个ping包来解析网络转发原理

"房东,我ping不通了",相信在外打工租房的各位都有过这个经历吧.ping不通,一个简单的现象,其实蕴藏着很多的过程,今天我们就来谈谈,ping不通该怎么办. 在说这些之前,先介绍几个概念:1.ping包ping包走的是ICMP协议,什么是ICMP协议呢,Internet控制报文协议,字面意思不好理解,作用很简单,就是发送一些控制消息,来检测链路. 要了解一个协议,我们一般先看它是怎么封装的,查什么书籍都是假的,最好的办法就是自己去抓一个包看看,抓包的工具有很多种,我喜欢用wires

MINA 网络黏包处理代码

本文完整代码,可以浏览: https://github.com/hjj2017/xgame-code_server/blob/master/game_server/src/com/game/gameServer/framework/mina/MsgCumulativeFilter.java 我在网上查阅过的 MINA 黏包处理,一般都是放在 Decoder 中做的.也就是黏包处理和消息解码放在一起做,显得比较混乱不好打理.而以下这段代码,我是把黏包处理放在 Filter 中了.在具体使用时可以这

centOS6.5网络配置及相关问你题

一.使用NET模式在虚拟机上为centOS6.5配置网络 虚拟机设置里面--网络适配器,网络连接选择NAT模式. 虚拟机菜单栏-编辑-虚拟网络编辑器,选择Vmnet8 NAT模式, 1.在最下面子网设置ip为192.168.20.0 子网掩码255.255.255.0 2.NAT设置里面网关IP为192.168.20.2  3.使用本地DHCP服务将IP地址分配给虚拟机不勾选 如下图: 二.配置完成后,ping网关通过但无法ping外网的问题. 1.找一个外网ip,如114.114.114.11

网络数据包分析 网卡Offload

http://blog.nsfocus.net/network-packets-analysis-nic-offload/ 对于网络安全来说,网络传输数据包的捕获和分析是个基础工作,绿盟科技研究员在日常工作中,经常会捕获到一些大小远大于MTU值的数据包,经过分析这些大包的特性,发现和网卡的offload特性有关,本文对网卡Offload技术做简要描述. 文章目录 网络分片技术 网卡offload机制 发送模式 接收模式 网卡offload模式的设置 Linux windows 网卡Offload

网络抓包wireshark(转)

转自 网络抓包wireshark 抓包应该是每个技术人员掌握的基础知识,无论是技术支持运维人员或者是研发,多少都会遇到要抓包的情况,用过的抓包工具有fiddle.wireshark,作为一个不是经常要抓包的人员,学会用Wireshark就够了,毕竟它是功能最全面使用者最多的抓包工具. Wireshark(前称Ethereal)是一个网络封包分析软件.网络封包分析软件的功能是撷取网络封包,并尽可能显示出最为详细的网络封包资料.Wireshark使用WinPCAP作为接口,直接与网卡进行数据报文交换

iOS,Android网络抓包教程之tcpdump

现在的移动端应用几乎都会通过网络请求来和服务器交互,通过抓包来诊断和网络相关的bug是程序员的重要技能之一.抓包的手段有很多:针对http和https可以使用Charles设置代理来做,对于更广泛的协议可以使用tcpdump或者wireshark.wireshark提供GUI,方便做深入全面的数据分析.tcpdump则输出原始的包内容,好处是快速高效,之前写过一篇简单的微信红包图片的破解教程,就是用tcpdump来操作的.这篇文章主要介绍tcpdump的基本使用方法,阅读目标是能基本掌握并运用t

服务器租用中网络ping值过高的原因

其实在网络ping值过程中常常会有很多情况影响这个ping值问题,包括丢包现象,不稳定等等.究竟ping值的大小传输速度与哪些问题有关呢?是什么原因会影响他的速度呢?16年服务器租用运营经验的上市IDC运营商-亿恩科技来为大家简单的介绍下: 很多客户在租用服务器过程中都会遇到网络ping值问题,也就是time值.这个值是从PC对网络服务器发送数据到接收到服务器反馈数据的时间.ping值一般是以ms为单位,时间越大,表明时间越长,网络速度相对就比较慢. 其实在网络ping值过程中常常会有很多情况影

CentOS6.5网络设置

CentOS6.5网络设置 不知道哪里做错了,长时间无法连接网络,百度了各种还是不可以.最后自己提取了以前可以联网的配置粘贴过来,成功.配置文件内容如下: vim /etc/resolv.conf 1 generated by /sbin/dhclient-script 2 search localdomain 3 nameserver 192.168.75.2 [[email protected] ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth

linux 内核网络数据包接收流程

转:https://segmentfault.com/a/1190000008836467 本文将介绍在Linux系统中,数据包是如何一步一步从网卡传到进程手中的. 如果英文没有问题,强烈建议阅读后面参考里的两篇文章,里面介绍的更详细. 本文只讨论以太网的物理网卡,不涉及虚拟设备,并且以一个UDP包的接收过程作为示例. 本示例里列出的函数调用关系来自于kernel 3.13.0,如果你的内核不是这个版本,函数名称和相关路径可能不一样,但背后的原理应该是一样的(或者有细微差别) 网卡到内存 网卡需