|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
3 K! N0 S" q# X- h6 W, |) |3 P
: S" y3 h$ _# {5 j# e4 B5 q. v 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: + K' }3 }* t9 f# P
. h/ ^6 z* ]4 ^7 a7 V3 J9 ~) _
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 + K% ]' q$ ^' Y
( W1 j1 b* I6 v+ v/ I; E Options:
' G6 [# Q2 m+ g& [8 f 3 A g2 t ^- G( B
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 9 ?; w% ?4 x* \* t+ K8 q5 q6 N
0 a# D7 X) w$ u6 Q a0 i, o; P
不停的ping地方主机,直到你按下Control-C。 2 p, q2 s1 ]- ~, X. N; E) p' b
" M6 w; I" q K5 m2 O9 |2 R" [
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 - ~: i, A6 I' d7 N8 P: j
$ \0 B. b/ f' n -a Resolve addresses to hostnames.
/ A' Z6 W" j6 l7 ?2 X4 C8 S1 O1 @ + o$ t/ s; `! S% Z. {8 T; W' H$ z
解析计算机NetBios名。
j2 ~5 d- w) |* @' @/ \8 ~) b6 k 3 e5 Y, ^" J* B5 g- c( ]
示例:C:\>ping -a 192.168.1.21
% U5 ]: @- G5 N5 z
: _9 S3 t6 E; R* X+ g5 M* D/ ^6 [ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
5 p" k: g2 `$ t+ u . d; z! E' a# k
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
f5 h- Z2 U2 w 4 \" V g8 V3 t1 M* q5 Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , [+ c0 ~; \! z
. `3 v, W0 O) v$ S+ d4 R
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * E' C2 A L; S, [6 F" I. K
/ P+ k1 O5 `1 \1 }: L/ F+ c
4 J- b, @& K0 u+ n/ @
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + l \. m! y; B) y
2 w9 a- T$ A: ]$ \9 B) c Ping statistics for 192.168.1.21:
- [1 K+ Q5 d3 b6 a
& o4 h b/ B+ O0 ^. L F9 S/ L Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
' r5 r* X8 X+ d0 X! B
5 b5 ~1 a7 D4 _ Minimum = 0ms, Maximum = 0ms, Average = 0ms ( [- K6 Y) l+ A a1 s
( a0 w1 J9 Z* W( F* A9 o8 e
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 7 T9 _1 S6 h: f2 _7 Q
) s$ D# y/ y3 v" ?. i -n count Number of echo requests to send.
; ]! N1 w8 K1 f* |" A4 G ! f1 ~4 s4 m$ G( P* p1 A# G
发送count指定的Echo数据包数。 ; D' P( [7 H0 W; ]: t; v6 c3 N
m- s; k L, g( @$ ] 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
( P+ M [* U) ?( U# a $ u- i& ^/ o u! J+ O
C:\>ping -n 50 202.103.96.68
( }8 F- D3 {0 \2 a0 b" }) W 6 x" K2 i7 D r3 y, [( g
Pinging 202.103.96.68 with 32 bytes of data:
0 Y h: h0 B+ \6 ~* i9 N7 q# y * u3 ?0 t( v: k" Q5 @$ U7 ~
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , t! g$ Q1 X1 j* p
! H% i& U& F( o4 c2 V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " s. g- n5 E' R; e
& a( F& V7 Q. @% m+ J- u. }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : ]8 Z) c9 a; p9 ~8 U G/ t
# I. E" R Q" K- s* S {" f* n1 T
Request timed out. , [0 k2 v0 a9 c- \9 y9 Q5 P
; l' A3 W3 R- u: v
……………… $ v; k# n# a7 K, O
! H0 x" z/ B5 c9 B9 B
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 H& o4 T- Z; l p# x g! B
- E+ w# A2 Y' b, a; S9 G Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( ^' _9 S# y1 i/ _* Q$ @; y
1 ]2 Z) k; L3 ~5 x
Ping statistics for 202.103.96.68:
# b- t0 y- n: v8 d( S* k+ \5 i * F# T: P5 Q+ b: k/ l
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 0 N, ~ E# d$ w1 L9 W
8 J9 b" T# k( t& G0 Y5 ] Minimum = 40ms, Maximum = 51ms, Average = 46ms
4 s6 p7 i) |8 B, F
' Y3 R9 Z9 [. D0 U# P# B h# n6 S 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
; d# K" l+ K1 M5 f0 C7 G0 ]
$ O! G' @# h( I7 ` -l size Send buffer size. . Y% n5 J! L: @+ G! {1 }
; y5 b; u5 ?$ e! U8 P: m `
定义echo数据包大小。 |
|