|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 - z8 |, y5 m- \7 L
5 [% L- I+ Z1 d5 A+ r8 S* `: l 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 0 a, l: a- W& o
$ Y( h% |* @) ^- B) g+ e% t 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 2 V& \2 c; l# J
6 K ?, g( q+ ^: e. I8 i( u
Options:
, W6 X. C/ c5 [
7 F# i3 x; w3 \ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. - D2 m P2 }& x" q* o
, \' [! R; ^- f' o% ^
不停的ping地方主机,直到你按下Control-C。
) j: _5 T9 U+ l ! u# Q) s5 a. b+ e* s
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 5 E1 b) o( l( n2 l
+ {7 s; O% N. e* |
-a Resolve addresses to hostnames. 5 d" A# t0 s- @/ w6 G& j8 h
0 h4 y4 @* u N 解析计算机NetBios名。 1 i3 B* q* C2 Q( @6 C& i! i
2 a6 [. f% i: n H 示例:C:\>ping -a 192.168.1.21 8 ?0 t2 P1 F! C) l
/ X# L4 S6 t ~' k! F Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
. P$ L1 q3 m( B) o* }0 X+ O, Q3 h
) t9 B- Y; r6 I; i: R Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 W) z. x/ n" p7 q
8 B: k. `" |( a: @8 x- ~# I Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + X+ D% |1 d. y* p* |# e
2 m! {2 _) T5 G* p2 ?# ` Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* t% h* z' i4 E' C' k
5 R9 ]* R" r( n( a; p - {) [) p$ k% a( N. K2 ~
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 D1 a- d/ Z5 G& [* [% x
; U0 ~; n' e) E9 n) r Ping statistics for 192.168.1.21:
% G5 b) m* P- d* J; x" N. {: { * `1 g( R: P+ L, c9 }9 n8 n
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 4 x" F" V% w$ o0 \ @. Z% C$ }
0 ^% j$ _* b x" a" ~4 j+ s n
Minimum = 0ms, Maximum = 0ms, Average = 0ms
/ K9 y/ c3 f. S/ O ) [. X& t- I/ H. R1 L! y2 w
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 - F7 |, ^# {( D8 |: X
3 U3 |8 X, `/ v/ L/ G/ L6 {0 `
-n count Number of echo requests to send.
: F6 E5 Z1 D$ c# |, R
- x( t5 Y9 a2 T# q0 ~) y7 ? 发送count指定的Echo数据包数。
& T e5 H. Q% x$ N9 m" s
6 Z6 M2 M: @! X; ?3 q' Z 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 0 Z( }8 }6 D6 U9 z
8 E. i$ a0 K8 D9 }: K
C:\>ping -n 50 202.103.96.68
9 u1 J* E/ i* W + z2 u6 o1 K7 ^7 I$ a
Pinging 202.103.96.68 with 32 bytes of data: / R1 i# f- }/ y9 c4 N
* e0 z3 Y( ~. ^( p/ d8 {/ z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 u' K7 n' F1 U) k+ ]% M
' W9 }- C0 |8 ?! z4 }' w Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# g$ ^+ _5 N v4 H6 X
N9 Q9 p: K4 X. N6 ~) |+ y c Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % ?/ s. u: _1 z6 h+ _, H
+ b) X( y& X( h; U* f U0 Y Request timed out. ( M& b5 Q3 h! s
/ g+ Q) c' H5 S4 g
………………
" `. H7 Z7 c3 U+ a : J% F6 j9 F" G1 w0 o# j. j% F* U8 |. o
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 h! J3 g0 }$ {& C& o! g/ w & r# @0 K' U& R [' B" D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ b- b, B2 T8 \: Y& f $ f, T! i) y: `3 \, f) b+ s
Ping statistics for 202.103.96.68: 0 z& O# D: j7 O; h" w7 |# a
' n7 @4 ^' [' G, J! j7 q6 q- Y
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
1 N/ ^5 v, u. H, b# R. P$ Q( B& z
( {5 I2 U1 w' T4 ^ Minimum = 40ms, Maximum = 51ms, Average = 46ms
z7 o5 M( p! a7 P4 k, D
% {/ `% h8 r; D" f8 x 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
{- S0 V: L& X5 c& ^" v4 T
3 Z# [8 N& P1 v) L( W -l size Send buffer size. " i: g G0 a2 y7 a5 u# t, k6 g6 R
: w0 g6 z5 H6 ~! \6 {( ? 定义echo数据包大小。 |
|