|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 5 v) g2 o. q3 k2 Y
) o& s' K, s# S3 j/ D& @ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& Q4 N' Q0 ~$ j$ E( i% N6 Z
! ?$ o& r( k8 P- R 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
, U* I g' y1 X, A& V6 i4 J
. h% R! b4 s8 }* X {6 I+ h! Y Options: - V% X. A2 P; h4 {7 C- o
* f' J9 `5 L4 n3 ?9 D" c: y9 Z -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 1 z0 `+ ^( d7 U; ^3 \
& v2 b& D* k `; l4 R 不停的ping地方主机,直到你按下Control-C。
9 T5 _, Y9 ]1 Y% q 0 ~, I5 {* j) p# K9 C. `
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
4 L0 k8 x$ n% R7 j0 {0 C) M
5 F" y0 r- [2 {/ j& [, Q: K2 A3 f -a Resolve addresses to hostnames.
" n( R3 M/ ?6 W2 A$ z
1 w7 @, M: g( U# ~ 解析计算机NetBios名。 0 o( D# d* r, n8 U: J1 c
7 h& [- U6 J6 V5 h v0 | 示例:C:\>ping -a 192.168.1.21
+ N8 I7 J- }9 Q: D1 B3 d1 @ + W1 L% ?5 Z" X. h
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: % o! m, L1 r9 q, Z! c' ?3 n
3 e1 w; X9 G. N8 K" j: Y! C
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 `+ O' J/ ?2 y. S% u: } . G6 W8 ~) l5 |. C& L& d: i
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # e/ l" P* F6 b- P% N
+ q- d1 H8 x, f3 H) h1 A Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 T7 A8 l* ]9 e! J
# s: }0 t2 Z( t" J
9 V4 J: `1 }: M& q' c Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 J# A& T# H, m, A 0 o! s% b. N& g
Ping statistics for 192.168.1.21: $ m! M9 d; n: J1 a o. C, l
* R$ A1 |- ? W i Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
, \0 ]+ D$ u, P/ l
+ T( w! C# w( l: ? Minimum = 0ms, Maximum = 0ms, Average = 0ms
0 e. p) h8 V5 P- ~ 8 l3 M6 s0 Z" m; T
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 w% q, v' g1 Z6 s- s5 @3 ]
" P/ f5 F" Q' M8 Z: W: Z -n count Number of echo requests to send.
9 T: p/ `' c( x% k8 Y
# @3 r; l# ~! s* E6 @ 发送count指定的Echo数据包数。
0 o5 V* T' I5 G2 H* P. G1 @. ~- S ) i! M0 z% s! U7 F0 G; ~
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ' ~ x1 J* T. i3 k- D. E0 \. Y+ |
2 B/ s; _8 ^' ]
C:\>ping -n 50 202.103.96.68
, k4 s( ^4 |% s5 G, W8 D
1 ]% Y' n! s, T Pinging 202.103.96.68 with 32 bytes of data: J. G: O( a/ B" d- z4 B7 X, K
8 H9 [8 T! _6 F, s I' \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# F. |# s+ K3 c7 k g# t4 f & d8 l _+ h4 D. J
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ e' \8 o3 B# m9 j8 K$ C5 b0 i {
( S4 R* O u! n- B5 G5 b Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 s M8 B4 l" _/ E# B* W5 r
2 R: l; _8 _6 u/ j Request timed out. 7 r1 J- Y4 Z9 i, j& b( Y
6 H( S% H4 E- F6 p. \& ] ……………… 4 w7 j8 u# B9 r4 O
0 g2 Y y6 d! U4 e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: X( W) L$ v' {8 k$ \; }9 D2 h ! M6 G M% r; j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
@5 H9 `5 c- [+ j% C 2 y! T) \- H$ h3 C
Ping statistics for 202.103.96.68:
. b8 @" U J! J: J( y9 o L0 C6 N + S1 L. P4 Q0 P$ s* ]1 m
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: . N4 L* N$ a; a1 ~' }. r8 S
& q# J' h Q+ N Minimum = 40ms, Maximum = 51ms, Average = 46ms
- L% S/ t3 P8 ^' X
5 l6 C' O a p z 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 w! K, M o/ ~/ {# g
- U. ]: f" o% V8 f -l size Send buffer size.
2 ]5 l5 Z, G8 u' O9 k+ d! _
. ~# |3 j! x% ^% q7 f- r7 p1 U 定义echo数据包大小。 |
|