|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 8 Z; @% ^- d% ^* o; {! y
7 J7 q9 |2 q' p1 E9 a' G" N2 n
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 3 X8 ?$ v2 |% G* K2 T# o% L
" B" K4 V3 x$ \# q2 I" a7 U
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 ) G2 H3 O3 B( ~" g
, |8 a; q) G/ e
Options: f) G4 h; i+ {5 n( m2 n
* v" v$ h3 c7 O9 R5 c -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
" |) s! @5 v- _
5 [3 U$ F4 N# v o 不停的ping地方主机,直到你按下Control-C。 / V. j- {1 u3 g: e; g
) A' ^3 y2 q9 V& L6 \/ }/ W# S
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
. P S& f- j8 c5 h) L" H
! k" E5 }6 p" e u- y4 f -a Resolve addresses to hostnames.
$ ^. B; Z( b; O* e4 w 5 o2 ?' }9 _$ |' q$ X: U
解析计算机NetBios名。 - x! B/ N- ~2 Y8 F
; Y0 |% c/ Q4 G# i3 i% }9 c
示例:C:\>ping -a 192.168.1.21
8 z$ x- ~7 K s0 a
" e0 d! M# ~4 `4 w- h x. n: H1 l" } Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: , f" }* [2 g0 W5 F( ^- H! l8 c
7 |/ f- j2 ^6 a8 A+ R7 W5 } Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ; ?+ l: i; m+ I
d5 c- `) z1 @: P Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 B) R+ ?& T+ k5 \( }5 e
) O$ T2 T. @1 }" w/ X, w Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; t% T9 l r- k
9 y$ A+ ^" Z& V" ]7 T- W+ V6 y; ?
! T, Q0 w# P6 k5 a" s Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( R; r; T, w- t2 s0 r. Z: b 1 M; o# n% ]5 u% A* g+ L2 G. n5 f
Ping statistics for 192.168.1.21:
2 I3 o6 m$ l6 S; {9 b 1 }' Z& j; l: B1 C: Y1 z) r
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ; O7 i* Z4 J6 E, v
6 {. E+ o# H' n- \& H Minimum = 0ms, Maximum = 0ms, Average = 0ms % F! T) w1 H# F# S# y5 F6 s
( S# @' w2 k3 c 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 * Z5 N# C3 Z1 b. j( y2 k! H
1 J C' D3 Y7 u8 S% y$ K -n count Number of echo requests to send.
3 `5 C4 f$ p1 w* N: d
' A! _. h9 K& d1 M( V' s 发送count指定的Echo数据包数。 2 x% o1 \$ `1 n" I
& {- ]& D9 U7 T$ _9 S: b
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
- j, Q; Y" D. Z: b" ~0 f* [ 4 Y7 y7 j" |- Z& h
C:\>ping -n 50 202.103.96.68
# S+ R! V' [( f2 b+ J6 J" e. ?
3 E, \3 X5 ~. _- L1 O% @ Pinging 202.103.96.68 with 32 bytes of data:
, Y( p# b9 b+ g5 L, K. u$ l( N) Y$ b- s
7 j5 x7 O- |* X! v S! [ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: h' O, Y, I2 r1 k; @
K7 y' l( A+ s1 d5 k Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' }) c1 w# w n. W* k
8 I5 V7 z* [6 L: }7 w7 k# q2 j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) d2 z$ P3 g+ o# `7 F
9 L' b! d$ c5 W6 }! [/ s; v
Request timed out.
5 k5 x+ `+ Q# l* y3 u + n: Y. Y# ]& o
………………
- N5 @: o9 j8 a1 K; h5 G * z+ u1 C$ O; {! f0 t% P; i
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 # d$ j; ]0 b+ ?$ p; H
4 N. l. r# f' t& S6 ^& K% o" | Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) b2 Z8 ?# \$ \ [
2 Y# e+ Z0 K# C$ k Ping statistics for 202.103.96.68: 4 i2 |' s2 u. U2 F
5 P+ B- S7 a/ b2 T# R Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 w! D1 j# m" [ B9 y2 {
. g* A# {0 e1 Q4 J" r; {/ A( U5 U Minimum = 40ms, Maximum = 51ms, Average = 46ms & s) K5 h$ ^% G( c
& S+ O4 S0 C& X. B2 `, D, }' N
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
& N* N' w4 @2 h9 Z( f * }/ c( a7 ?& V
-l size Send buffer size.
. f+ N& U+ L# k! T! g1 r8 R5 L
, B e9 ~- s" ^; d+ W9 o 定义echo数据包大小。 |
|