返回列表 发帖

教你正确使用Windows的Ping命令

  对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 , L/ b  W  K' j2 g0 i
  
4 v1 ]: G& I3 A4 ^  现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
) d8 z( E2 U' [* |4 M5 U   2 i5 M8 I) v0 P3 [- ?7 O; I- m4 a
  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 & G" g$ J; d/ V2 \' j4 U
   % X# ^( h' K5 P) n3 {! R/ `( J% p* y
  Options: ; H# ?1 d+ c! q
   . R% `% M. c7 U/ G' l6 c
  -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. + C- j' k; t0 p- I3 O9 c1 I
  
/ q0 O* t/ P% y. ]: T  不停的ping地方主机,直到你按下Control-C。 1 u" ]% g6 ~0 {- c- O
   $ o) h* q- u8 y/ \! E4 L9 ]$ D
  此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
) ]: C! g2 l1 m) B   ' l* H: ^+ w/ t1 I0 y: g2 Y
  -a Resolve addresses to hostnames. ; R% \/ H9 U# Q" S5 ^
   * T! Z  n( V- \8 n: Z5 @
  解析计算机NetBios名。 : X0 R3 h9 e; g; X* O1 m- x
  
, W2 |; d! b7 |4 a5 I' u  示例:C:\>ping -a 192.168.1.21 8 H6 s9 X9 W, X, @  X0 N/ i4 p+ |
   6 y3 ?5 M9 x7 H" s1 L4 M
  Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
" `0 l9 {9 ?- {. u! F   ' u$ w( b5 O2 W6 o, ]
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( F/ f" m# P: d, \
   ! M# m0 k. R6 H( p" U4 H
  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 F# C2 b$ O- [2 U  
8 T& p# {/ h5 G& m* s  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 ~( D# u+ T7 O# g8 |' E4 e' C8 U( ]) S; k  M4 c
  
/ [2 u" I/ V) i. i. T# r$ E  Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. q# {2 \. g7 R   , F) ?: C; O5 B* J% h
  Ping statistics for 192.168.1.21:
  j, i6 y1 {7 R, f. E! A$ @  
" Q+ g- X" K. Y, u& O  Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:   k( q2 c  C! c
  
- D' [4 I0 n9 A+ w* o' @5 j  Minimum = 0ms, Maximum = 0ms, Average = 0ms ! E2 h5 Q0 ]( a6 j+ n. P
  
. R/ U3 `# f6 D& j* C6 ^( {  从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
$ c4 E- m9 r; c; a5 f  
, j& l" T8 n5 ?6 P) j" [  -n count Number of echo requests to send.
) v6 S. n* i. l; B) m7 l1 T+ {   " G9 E% h5 G/ S; T$ L5 u) l
  发送count指定的Echo数据包数。
7 m' a; Z+ g7 D4 H- t  
* ^7 {+ |" A' A! \# g8 }  在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 9 u! y& u4 f6 j
  
% L( t* g6 N9 ]8 }; r/ E6 g+ z  C:\>ping -n 50 202.103.96.68
- @) Q( }( [; f+ p# q% c$ V% q; x  
1 d( Q$ y1 {' _  z) a( v  Pinging 202.103.96.68 with 32 bytes of data: . U& j, M5 ?8 s2 w- b6 @- _. z2 ~
  
5 Q4 e- I6 F+ [& g, J9 {  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241   b" w" }* Q8 @* U- b1 h) a
   ' a. ?$ c4 g' p( u3 b" f* H' I. r
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! t; E$ x1 q& ^' l# n0 u$ f  ]  
) v+ h7 R: \' i, L+ r: x$ b  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 V4 K& c& B* V% v7 I1 \( J* w. Y
   7 y+ G& T1 a/ ]7 f
  Request timed out.
2 q9 w) J, u: w4 u0 {6 z( k' R  
( ]( Q# \  r, d# k+ Z  ……………… / a3 Z0 _. p- s) m" L
   5 @# O- }5 Q5 V. m
  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- S- O0 F6 y* |0 J( J  
6 c# W# ?$ d2 s% _  Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
! Y6 Q# w4 I3 S- B& k3 `7 g   - Y7 W2 [2 u- B5 @; @
  Ping statistics for 202.103.96.68:
1 ]) Z# z& @7 \* M5 `7 ~# ]: ~$ W   $ z& c# g' c. n! w" {" [& u; x
  Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
# ^& k. V* u" v5 G$ ^   * H% F& ]$ K! ]" c) R  `, c
  Minimum = 40ms, Maximum = 51ms, Average = 46ms
% p% _5 s- H4 K+ T: t7 Y# W  j1 H  
/ q5 s$ _: O* t9 F  从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
$ g* W4 F6 N+ i) Q" `$ a   ! U! r- P$ g$ h, ?
  -l size Send buffer size.
# L  n0 @# H4 h7 s  x  
6 B: _3 x' Q* ?) A  定义echo数据包大小。
89w.org捌玖网络

强大,但是我看得不是很懂!

TOP

返回列表
【捌玖网络】已经运行: