标题:
教你正确使用Windows的Ping命令
[打印本页]
作者:
野人e族
时间:
2008-1-27 22:16
标题:
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
4 |' b- S. T1 a, d' |; {( l, Z
! T& [ u6 f$ y8 Z" H4 s/ V
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
( T4 T- ^/ z5 A- M% E
) M% B& P4 M" ^2 D- H
ping [-t] [-a] [-n count] [-l length] [-f] [-i ttl] [-v tos] [-r count] [-s count] [[-j computer-list] [-k computer-list]] [-w timeout] destination-list
' _0 u* \* Z: M1 ?; ?
0 J3 l5 D( u0 w: x% Q( U+ h7 {; D: E6 i
Options:
9 h. ?# o& E( y7 P7 K" k; w/ M# r
- A3 I$ b+ ? F; A& m* K
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
5 H5 |; M8 O- @$ ]: D
$ L/ d1 {. d! K9 x
不停的ping地方主机,直到你按下Control-C。
( ?! i( I1 u6 a
5 f9 p( \6 s; [4 ~; |( T0 v
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
, R; u9 M) l9 b7 ~! Y4 L% @
1 y% d9 B X0 W8 \ u3 k
-a Resolve addresses to hostnames.
3 y. ~0 v: P# D6 `$ [0 N7 X( R
5 ?; S7 p+ F" x* I9 f
解析计算机NetBios名。
, Z `4 b$ ~% Y; F' |- q7 \
) B9 w' g# [5 i
示例:C:\>ping -a 192.168.1.21
+ t* ?, s0 C+ V' r7 U7 R; q
$ x! ^9 q3 P+ n' p7 o
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
* _6 C8 {7 h9 x! i
% `; v* ^+ J! I+ ~
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' B; v, r4 v+ a: s
" ]5 m3 z5 w9 W
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 Z- e- y* \. ~* \" [
$ c `1 ]! X7 _; q% @8 o0 z' r4 l7 m
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 T* b5 y5 q9 O. p, T2 b A& ?0 r3 K) N
& e$ |$ F( l" @. ^
/ ?6 Q: ?7 G# h Z/ J
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( ]; b" x% v+ i
+ _' E' G$ k' Y" V! [
Ping statistics for 192.168.1.21:
9 z& N3 W7 U' L& X8 {9 y
# ~4 i2 @' w; w# Y9 c+ A0 H
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
6 \6 |2 |3 B: [
* n! G3 z( r/ P7 W5 Q
Minimum = 0ms, Maximum = 0ms, Average = 0ms
- e+ q. |# B) N, p1 n! ?
6 [6 E2 j4 h$ W! j8 Z: I6 q
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
# a& ^; b" r! c
. k# E2 J( j4 L) p
-n count Number of echo requests to send.
3 c9 Y$ [' s* a& C: X! z5 B
% E, O6 i* p7 o& I5 y
发送count指定的Echo数据包数。
5 l8 D( s1 q+ L0 q: _ }
+ E' U2 R Z! U0 T9 c
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
) v+ x8 z& q1 K5 U6 Q4 E. }
3 n% {3 a* z0 O: o+ R6 O6 m
C:\>ping -n 50 202.103.96.68
! {) p* X8 m# o4 P) W8 q
% X$ D, `- Y* r, ~
Pinging 202.103.96.68 with 32 bytes of data:
' e7 m2 k1 j. @/ w. w
4 X; h" x% @: S; u$ S$ A/ x
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! |- m$ C* `( S: `' i! i3 D2 D' I
. B& j8 h, n4 I `" }% j& T5 c5 z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 _+ M3 J4 ~' |
1 P* P4 h* D* \/ }% x/ Z5 y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 p, C) U) I: }2 h# i
$ [, K, x0 N% y( {7 D
Request timed out.
2 i4 k$ S5 r/ j: n2 {
$ h: ]( x% ^8 ?; @2 ^
………………
) N0 g0 {* _$ x, m8 A
L6 p0 |. l+ g& B& {- \ ?+ V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% a6 U" _1 }& K' ]8 C6 L+ ]
2 x- D- m$ C" S# [9 g& d( l9 p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! O/ }+ ?* Y& g, ?! g1 c/ T0 ?
$ g+ m$ U. J9 L+ f& J! C% P
Ping statistics for 202.103.96.68:
: K% `7 Z* i! V) X& n+ J
8 [% n" s3 w; ~, w
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
/ ?) `0 H# N; T9 n" ]" w
; A7 Q. n' r/ c" c/ \
Minimum = 40ms, Maximum = 51ms, Average = 46ms
" @3 y3 o4 f' ^1 b# R: l$ M, n
: o# e5 O7 D7 C$ B5 R' E* P ~
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
* U6 h) ^1 o; Z5 I, ]9 b
9 T& z. }5 l- M0 r8 U, g# B& M9 c
-l size Send buffer size.
/ c/ O) ?/ ~' }, C7 r: Y
6 ]( R8 b8 }' S* {4 `* B, X0 t
定义echo数据包大小。
作者:
冷雨清心
时间:
2008-9-25 15:54
强大,但是我看得不是很懂!
欢迎光临 捌玖网络工作室 (http://89w.org/)
Powered by Discuz! 7.2