|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
$ b, C$ B6 n+ F+ a 1 [7 r: @2 f/ c8 c6 ?7 |! B
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: # o3 ~% x, K2 m# U3 W& Q5 j: G/ J
2 T* Q g( t4 P$ ^
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
9 {; T6 K2 V/ J( I( x
6 P/ _' E# T( q8 D' J: G# b. M; ? Options: : N9 X; C; j5 r. ^, q
0 i, w. a3 E+ n5 \3 Q1 l" y# Q7 M -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 C0 p3 o4 X5 i, S, {" z5 o1 {0 }
0 G/ B( R( L6 x6 {9 v
不停的ping地方主机,直到你按下Control-C。 2 T5 K2 C! g) O4 _+ W
" i. m1 k# d- R5 E n% D% I5 f2 j' P1 _
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
! f: Y7 x: ~# j4 J3 K
' j6 {5 ?, k3 |4 a5 q/ F I4 u) ^ -a Resolve addresses to hostnames. - e8 K# B0 Z3 f( W" G) h' P
J" [0 D) b+ L 解析计算机NetBios名。
L1 X- @* \8 \- |0 [% L7 x
+ J% [; { P; m/ x" [' W 示例:C:\>ping -a 192.168.1.21
2 G# J2 `8 N3 ] 9 Q! z. Z# M# G
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: * C) U) `+ ?" u! w4 n6 n
9 [6 [+ ?' b% y# @: } Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( }/ j. g t* Z8 z; ^
- B+ b; b; O- H C! c Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / i! o% J, ~, b7 E* j* T4 h
5 j. S: C: @& G; k: S9 G Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % z, h* C/ T3 e) f) ~! T
8 P! E& g3 ^) m* `" Q / z, @. }- E: v
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& E; r5 X: {# M/ o* L$ Z5 V0 X! e {; Z) ?6 v$ a# }6 w; n+ W0 ^, m- T8 m, K
Ping statistics for 192.168.1.21:
$ @* s& r; g# h& D/ E- S! J - Q; q7 i4 I- a Y; g
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
, O( w" [$ e* e2 e# X- A+ Z
4 k! m, o& d& H, V+ ` q7 L3 P; X Minimum = 0ms, Maximum = 0ms, Average = 0ms 9 U7 L6 \! d5 S3 Y2 J0 {
8 C2 H) x% z. i6 V8 K
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 . V" y3 ~) J$ ~8 e
, y8 }" X& X1 | -n count Number of echo requests to send.
3 M, D! _5 E; }7 ]
0 T5 R: H6 ]- M# {( i 发送count指定的Echo数据包数。
7 m N/ O4 `. p9 N4 [# x6 n2 ?1 p ' c7 t5 N% t4 M& |1 L
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 0 l6 }6 v6 P: T) p& @
& b, h# g% `0 I0 e
C:\>ping -n 50 202.103.96.68 ; D1 {: d) F/ C) R
; U5 Q- x" {* |) J- j7 T4 w2 H, V Pinging 202.103.96.68 with 32 bytes of data:
; ]. P- g) r- T6 J! C& B4 z ! _; x. }( l0 {/ ?
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: y$ a1 P" }( q9 O# u . i4 N; y$ B, K0 s2 t; ^
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 o9 g) \' L) M$ L. B8 t. D" \+ l& {
# f$ a" ?, r& A
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 G H. Q) ^3 G# [% L
# V% B. S! |2 D a5 S5 R1 q7 M
Request timed out.
* R' b F* ^$ c2 |
7 x& X* o/ L0 f) S ………………
7 K: j) }; O$ [ x0 ]% e! [; I# z) b- Z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 @" v) e, w. Z0 e# j1 q: l9 D
6 Y3 {3 e5 y e' c2 r3 x4 a2 d: c. s/ z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# t) _& N/ T" Z 7 l/ H* ~) u, g/ L( E! \- O4 m
Ping statistics for 202.103.96.68: $ I' l+ B0 O1 C' E
) D4 W% e% v' }8 n; ^
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 7 T! g$ {3 |+ {) V+ `
1 X; K) j4 |& E Minimum = 40ms, Maximum = 51ms, Average = 46ms : d: ^# d- _1 T1 D: H
. R+ k) Y/ `# h! P/ H0 B 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 9 y+ q3 x! L Z. Y
* i5 m$ `6 p+ x
-l size Send buffer size. 3 c6 _: v4 i# j* [7 `
* k4 n4 t/ d# w8 W# ]0 t
定义echo数据包大小。 |
|