开发者学堂课程【Linux网络进阶 - TCP/IP协议及OSI七层模型:CCNP必备:Linux网络及0SI7层模型深入讲解】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/552/detail/7629
CCNP必备:Linux网络及0SI7层模型深入讲解(二)
二、IntemetControlMessageProtocol(ICMP)
用来实现pin命令
可以用来判断网络状态(根据不同的网络状态会返回不同的信息)
ICMP数据包大小默认64字节
PING172.20.0.1(172.20.0.1)56(84)bytesofdata.
64bytesfrom172.20.0.1:icmpseq=1tt1=64time=3.
20ms64bytesfrom172.20.0.1:icmpseq=2
tt1=64time=0.547ms
64bytesfrom172.20.0.1:icmpseq=3tt1=64time0.
390ms
172.20.0.1pingstatistics
3packetstransmitted,3received,0%packetloss,
time2002msrttmin/avg/max/mdev=0.390/1.381/3.208
/1.293ms
[root@centos7~]#ping172.20.0.12
PING172.20.0.12(172.20.0.12)56(84)bytesofd
ata.
From172.20.102.77icmpseq=1
DestinationHostUnreachable
From172.20.102.77
icmpseq=2DestinationHostUnreachable
From172.20.102.77icmpseq=3
DestinationHostUnreachab1e
From172.20.102.77icmpseq=4
DestinationHostUnreachable
From172.20.102.77icmpseq=5
DestinationHostUnreachable
From172.20.102.77icmpseq=6
DestinationHostUnreachable
From172.20.102.77icmpseq=7
DestinationHostUnreachable
From172.20.102.77icmp_seq=8DestinationHostUnr
eachabl
172.20.0.12pingstatistics
9packetstransmitted,0received,+8errors,100%
packetloss,time8003mspipe4
[root@centos7~]#ping172.20.0.12-s65508
Error:packetsize65508istoolarge.Maximumis
65507
[root@centos7~]#pir172.20.0.12-s65507
PING172.20.0.12(172.20.0.12)65507(65535)bytes
ofdata.
172.20.0.12pingstatistics
4packetstransmitted,0received,100%packetloss,
time3000ms
[root@centos7~]#ping192.168.30.128-S65507
PING192.168.30.128(192.168.30.128)65507(65535)
bytesofdata.
65515bytesfrom192.168.30.128:icmpseq=1tt1=64
time=4.48ms
65515bytesfrom192.168.30.128:icmp_seq=2tt1=64
time=1.19ms
65515bytesfrom192.168.30.128:icmp_seq=3tt1=64
time=1.08ms
192.168.30.128pingstatistics---
3packetstransmitted,3received,0%packetloss,
time2004msrttmin/avg/max/mdev=1.083/2.25214.4
82/1.577ms
[root@centos7~]#ping192.168.30.128
PING192.168.30.128(192.168.30.128)56(84)bytes
ofdata.64bytesfrom192.168.30.128:icmp_seq=1
tt]=64time=2.81ms
64bytesfrom192.168.30.128:icmpseq=2tt]=64ti
me=0.585
ms
64bytesfrom192.168.30.128:icmp_seq=3tt1=64
time=0.217ms
64bytesfrom192.168.30.128:icmp_seq=4tt1=64t
ime=0.335ms
64bytesfrom192.168.30.128:icmp_seq=5tt1=64tim
e=0.340s
64bytesfrom192.168.30.128:icmp_seq=6tt1=64tim
e=0.302ms
64bytesfrom192.168.30.128:icmp_seq=7tt1=64t
ime0.260ms
64bytesfrom192.168.30.128:icmp_seq=8tt1=64t
ime0.260ms
192.168.30.128pingstatistics---
8packetstransmitted,8received0%packetloss,t
ime7007msrttmin/avg/max/mdev=0.217/0.639/
2.814/0.828ms
[root@centos7~]#ping192.168.30.128-s65507
PING192.168.30.128(192.168.30.128)65507(65535)
bytesofdata.
65515bytesfrom192.168.30.128:icmpseq=1tt]=64
time=1.68ms
65515bytesfrom192.168.30.128:icmp_seq=2tt1=64
time1.39ms
65515bytesfrom192.168.30.128:icmp_seq=3tt1=64
time=1.50ms
65515bytesfrom192.168.30.128:icmp_seq=4tt1=64
time=1.44ms
65515bytesfrom197.168.30.128:icmp_seq=5tt1=
64time=1.48ms
65515bytesfrom192.168.30.128:icmpseq=6tt]=6
4time=1.46ms
65515bytesfrom192.168.30.128:icmp_seq=7tt1=64
time=1.39ms
65515bytesfrom192.168.30.128:icmp_seq=8tt]=64
time=1.47ms
65515bytesfrom192.168.30.128:icmp_seq=9tt1=64
time=1.88ms
65515bytesfrom192.168.30.128:icmp_seq=10tt]=6
4time=1.38ms
65515bytesfrom192.168.30.128:icmp_seq=11tt1=6
4time=1.34ms
nC
192.168.30.128pingstatistics
11packetstransmitted,11received0%packetloss,
time10019msrttmin/avg/max/mdev=1.346/1496/1.
882/0.154ms