  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
; d) E. r+ ^7 O
$ K6 M! u* Y/ G# j7 \9 Q 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
4 g5 P) E6 q/ A
6 E1 F* M. o( j 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 0 {9 {) E6 H5 }+ L$ A+ o8 b
. @7 w3 N# j0 h6 {& t/ F8 I: x$ k, a
Options: , [, {$ T: R3 }& p5 E; c
1 y! r5 [: [- L7 Z0 v) w2 n7 s, l
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. + f& s/ p/ B" N0 r. i0 z# s: q. O
- U! T X1 N+ \2 |+ H
不停的ping地方主机,直到你按下Control-C。
$ B( ~% o) e9 W' k9 t5 y
0 Q7 @1 g: J0 S" r 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
' S" T; x B+ u/ G 9 d% g, j- O' M6 y$ O
-a Resolve addresses to hostnames. 9 j! B' H G* \% B( }1 T ~7 Z
* x6 _: b$ {% x% I( ^! u9 r 解析计算机NetBios名。 0 J0 h- x3 Z. k) t
+ q% |$ s: [( ~* q3 K, ]1 Z
示例:C:\>ping -a 192.168.1.21
- M# y3 R$ q% `6 [! z+ X4 N
% W8 x8 B3 z! N! N0 d Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
8 r& H4 R/ J8 c1 W) P0 g& [; g * S: k# q$ N; O- V: `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 p$ M% e N( Y& i# z* e
5 F( |: R8 j; p6 n/ r
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* k7 J& f" A/ O 1 H3 O( N+ f9 G6 ]' U0 m
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + x; [1 U8 X! n5 c# n$ y0 C# T
0 k6 B) q, C. d) R* R* ?! l
: F. _( D% r E( R& R* r6 Z1 i) y: M Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 8 n# u A+ E* a5 S) ?" C
- \' b, v$ G& X4 F7 f
Ping statistics for 192.168.1.21:
: N# A2 s2 x" e- ^7 g9 ^( [5 n3 ?' X
6 D$ u; r9 N! z Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
s6 X9 y) I/ l# s4 w% s* j& b" T " f* {1 @( X6 G" N
Minimum = 0ms, Maximum = 0ms, Average = 0ms
- v2 h6 H* ^ _' v$ [( e+ H5 L6 P6 t 9 f# w% c1 x# a# U0 D
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
( Q1 `" o7 {- u3 Z) N, k3 {
7 ^2 o, \# j" y) z' j3 i0 }3 r -n count Number of echo requests to send. - s* M: k3 f; @7 O& S7 r: ?) O$ P
+ I2 \6 a2 T9 n# r; D5 w 发送count指定的Echo数据包数。
2 w1 U: |& F6 Y; x) }2 D3 h 2 \, n3 Q/ T6 V8 g# M; f
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ' j# x4 Y; L$ [' V2 R/ u) |. b
; M* a' A& U p6 D0 x; m I C:\>ping -n 50 202.103.96.68
% j! M8 A5 e& f6 s; t! Z
& g/ g h! x1 W& u" }2 O: v Pinging 202.103.96.68 with 32 bytes of data: ! S. r* t. Q5 l9 k+ ]3 s; o7 I
8 `1 H* _4 ~7 y+ S$ { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - ?: M3 A9 m8 {' A
9 ?" b' A, p- K3 `! L6 { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( x* ]' ]# H W3 H, j1 [
X4 R' N) z# l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 1 G2 B; [9 f/ x/ g Y" O
" p! c0 U1 l1 t6 b. E
Request timed out.
! W @, r- k1 B6 I5 F2 t. j 6 B1 b. L1 d y% Q
……………… 0 u3 G5 R( [- V% b* l) g
2 W0 k3 S- e/ r( A
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ P1 y* m- Z. [8 r' R
% E% C) m4 F/ q4 C Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* O" ^1 F1 F& |+ y* t, U ( g6 o) T" d: {$ u
Ping statistics for 202.103.96.68:
! r! P( R) [( ~$ [* w1 a" L5 ]) N8 a
: Y. S; d& y! g; A8 P2 @5 n3 m Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
' h9 D3 a; Z) n+ I, A
1 |" M0 u' |) Y) d' ~0 t' c* e Minimum = 40ms, Maximum = 51ms, Average = 46ms ; n/ k" e) P; Y, ^% F8 k8 _! a
4 x- p) j( X1 W$ }5 y( `. H 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 4 V# U- b$ X3 o1 x; W& E) n
& \6 a5 z/ O. r5 R -l size Send buffer size.
( v& U7 ]. d5 s( s/ P 6 k0 n2 I) L0 ^7 z
定义echo数据包大小。 |
|