|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
0 }2 I2 Z0 ^" L
" R7 F4 k3 B& I& o$ e! n 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
4 P+ x1 Y& k# P& R$ D# T, N+ [% ~5 _/ y6 U / b# {: t" Q6 L
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
% Z& B4 {; p" T7 E8 G w / c* D5 ?4 ~6 T. S
Options:
; ?/ ~/ @4 `4 u8 `$ d ( g* U" L$ t" W- E5 n; t
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 0 F' a3 ^ b9 Y
) g6 k- ?. W7 b. e
不停的ping地方主机,直到你按下Control-C。
: V) u: p9 h. R3 g# b
4 v8 t: C& a( u$ q 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 5 c* J5 s4 i7 H. p( }
+ G6 D4 W6 P0 m2 E9 D2 x
-a Resolve addresses to hostnames.
8 @0 m. |8 {- l6 Q$ A) `( A# ]: Y / t5 q; g S) r5 |8 ?
解析计算机NetBios名。
9 R0 u1 T* u! n- E: o( d/ V
P, x; {4 w: C 示例:C:\>ping -a 192.168.1.21 }' m2 g& S# h
1 I5 W# U: |9 I6 `+ s. K q$ a+ P Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 6 |/ ?% v$ c; l, R1 e; ~, j- U
% h: L$ m0 w/ H* G6 f ~5 @- S
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 h- {( D" U$ b
- v) J& z) j4 F, E( K Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : E1 r* X) T% C! p, I
" A7 U+ K; C9 `) c& i
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 s, R% w, |5 L, S% G1 ~4 t
' G0 Q1 F4 N7 W2 F; ^
9 S. F5 m/ |3 G6 ^* ?% w
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 r8 `2 Q4 u" ~2 @4 ?# |
, |. G$ w. Q& ^7 C1 P' r8 \1 ?9 ` Ping statistics for 192.168.1.21: & ~% n% c! t1 L1 ]. J8 q
' w% _% K! _" a& T5 U4 Y
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
2 h3 h! ]# \ d: K4 y 9 H/ g$ V6 P) M" U: O
Minimum = 0ms, Maximum = 0ms, Average = 0ms
) P* ^) l. z2 P4 v % N4 S2 \0 S# p$ q# w
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 5 K& s9 p6 H8 p7 i' \
0 p0 P# l. v4 l4 F
-n count Number of echo requests to send. 0 o* I0 O1 k, F+ Z3 P
, `2 A& C( \ D+ ~; `" _' \ 发送count指定的Echo数据包数。
$ u1 }3 t; y! M0 {% G
/ ~+ v8 {1 W( j8 j* E 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 3 {6 O6 M2 x! c! ~' Y/ B- g. m
4 C7 s& f' E+ W/ ?8 l4 J
C:\>ping -n 50 202.103.96.68
& j% B9 E1 U+ ?: y% f
/ a3 O+ y( ?! |- C8 c* l Pinging 202.103.96.68 with 32 bytes of data: & Y. x1 x; P& ?/ }6 ~- Q0 O( N8 F
0 ~( g' }9 Q; Y' W+ I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 ~5 Q0 t5 I0 A" N+ E% X8 b, l / s( o% P J/ [, \5 j: J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' [7 n; D0 ~) B 7 t3 c0 g8 p) \$ H- H# q ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : e1 B! j" N; k8 j4 d
( V( M) q3 Y6 v$ `( Q% i, Y8 [ Request timed out. 9 H2 q: X* ^/ f" `
5 s& l+ V; o2 p( b" F6 S7 ?
……………… / i L) N* E3 w& C% Y/ g
4 f. {: Z1 h$ \/ G0 [! D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" e K# F, `( z% r ) H7 v' U' m" l! m; Q3 b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( Q8 w) H% g% V, K, i " ^4 Z2 R% D$ j+ D6 [) |
Ping statistics for 202.103.96.68:
; G4 U( h7 e0 Z3 {3 _$ D X- `! G9 [) }
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: . n8 M$ c) ~3 x/ A0 m- {4 [, ?+ k# M' B
% P# ?- K$ O0 D1 L
Minimum = 40ms, Maximum = 51ms, Average = 46ms 5 j/ {4 j& P/ b' P! X
- ]4 O1 I7 \: m% A5 Z( R: X' | 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
% r. W" `! o0 c1 q) w3 a9 c+ a 2 I0 b* Y) v! ~( ]
-l size Send buffer size.
0 I- f3 `+ o% _6 l4 a) K
0 T: r% u B7 O, } 定义echo数据包大小。 |
|