|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
8 A: v* n4 \" [# i) U4 F
( b, u' w! v/ k 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 5 G3 R5 \: g- d# }$ r& Q
+ W9 F! k9 i9 s& G ?2 w. \
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 1 ` }0 y! t6 f* E
# e* \3 c. h- H- f Options: ) { F! _8 E8 U# C$ z% s
& t, g9 l* V+ _8 i0 @) _/ J -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
& V/ X- h0 d& ~& c- z. I8 i* p ( X2 Q( A- l5 q5 J: v# f6 Z3 k& K
不停的ping地方主机,直到你按下Control-C。 . V' P8 O& @# ?5 U
* W2 \! s# b2 f: k 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 & D; \0 v# F! T5 J
! \, w$ W# C! K' |7 D( b2 O1 {- j
-a Resolve addresses to hostnames. * @+ D K5 a& i, {% s) B G+ z) t* y
. A: s# s+ T, F! C# J% t+ } 解析计算机NetBios名。 6 F$ d _) O% o
+ X0 x% N& v( I- B6 s, h) r 示例:C:\>ping -a 192.168.1.21 4 Z$ l+ s8 \) o/ `
: O8 p" L$ E( L2 g& L1 l
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- k; P7 [" J3 l- q7 d2 y, S
7 `. ~& W" s8 O6 h+ C# _ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 I" N' }2 n* N/ q2 q h% X
8 z" Z3 q) Y' D Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + w& p4 d7 O6 e) e6 }* d
# j) g( \1 }3 M5 [' s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ' `6 i4 w; A: c1 x7 Z( E3 e* j, l
5 U- h+ o! s$ p. {$ { F& w
0 q! s/ E6 ^8 s7 o6 j) }7 L
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 B3 S7 ]' L% }; s2 p4 M9 z ; z9 q" z5 l, a8 i. ?$ W: h
Ping statistics for 192.168.1.21: + b. n; m+ `- j7 g# A% X
( s" L0 b! M3 S* Z
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
; m% E( O9 ]2 D & \' r7 p8 T, M0 }* g6 I9 A% z3 [
Minimum = 0ms, Maximum = 0ms, Average = 0ms O7 L& N6 E0 X( ?& O
7 U; \$ }5 ~1 ^' V" ^
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 _3 `8 @* R0 O
5 |3 v9 G! {& N) ` -n count Number of echo requests to send. 5 y/ o, m- j4 [1 F) S3 {
7 }. i. U) C" i* g' S5 M
发送count指定的Echo数据包数。
! g5 i" s. t% ^( B
: n; Q* C- _4 v 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: - t; Z7 P# q9 Z ~
" V8 e v7 U/ `9 C, `& \ C:\>ping -n 50 202.103.96.68 ; d6 {# z7 i3 S/ d
* n7 ^9 O# I3 Z1 z0 w9 |3 \9 |6 ]
Pinging 202.103.96.68 with 32 bytes of data: , t$ B) g3 {* g3 `3 a
0 i* U% G6 @3 d4 \! {' K% l Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / h) ^) W& U2 q. ~% [1 T+ b, j, O
, G# o& N, U! t# u& i c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 I5 Y3 z' b( N- s2 r: D6 Y
1 j( K( D7 ?, `7 k% A$ w. M/ g
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 Q6 x/ U" i0 V9 D- ?
7 `% W" H( d0 t" A# F5 L E
Request timed out. 0 U- k. }7 _1 e7 ?/ z1 \- l: t3 e
; ^1 m8 P1 d4 m7 H) Z6 I8 ~. m
……………… $ z8 d& Y: G$ ?& Z
) ?2 H, N" Y7 n+ e& ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& f; }6 i* v4 V$ A. w" L2 `
) z' I8 j+ S# g& V a0 T Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' y: x) p2 Z" X* s# e! H ) n B& W3 U+ P
Ping statistics for 202.103.96.68:
4 V4 S( n9 _' q2 U3 q& w 4 G8 u4 ~- I& i. _9 G8 t
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. s8 u) I& r$ `: W) q9 u
# x4 B& R+ V8 i+ k( c; g2 E Minimum = 40ms, Maximum = 51ms, Average = 46ms
5 E& z* ~4 o" y7 ]# m9 d( t
0 [. J& A3 j3 `/ D( O9 O, j% O 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ( C" S0 K7 r, o9 V$ T) h
3 B) r' o* [! o' i; P& d }8 M3 v -l size Send buffer size.
; ?$ Y0 o8 `6 B ' p7 O- }' U. z0 {1 ~, u2 f
定义echo数据包大小。 |
|