|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
m9 A/ }7 O. X! Y8 D) n* j: s; H ; ^2 L/ k8 {2 `
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
! d# f( d/ s$ d5 e4 L ' a+ @: N* z; w* V+ 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 ' k- ~4 V' E% D; K7 N
* B' n% b! w( h6 Y6 l7 }& a$ K
Options: 4 \7 }, n' Z5 w8 f1 I+ O P
' Q# K% ]3 T4 W `8 D5 k! z: s
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. . P* t; h# O: c' z" \, {/ x
3 y! k6 M4 a' F) o, Z8 M
不停的ping地方主机,直到你按下Control-C。
I! b' x) ^4 U: h
4 g' E( Z% o$ a( C; ]" q! r 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
$ S' e% [9 i1 ~# y
. W- }: Q$ U! I W1 L -a Resolve addresses to hostnames. ) C/ s6 O' L; t1 g+ j" n8 C. c- z# Q
6 J A6 {2 d& J$ r- q' N
解析计算机NetBios名。 8 e; ?3 o3 D4 M% V+ [; c$ a
8 V3 P5 |+ _- L6 E, i
示例:C:\>ping -a 192.168.1.21
! A: c. x3 ?2 ]/ f3 _0 p- p5 e. A4 ^
: j. V8 g2 S! y7 r: y0 u) c Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
4 m5 @# ?0 z* @8 Q2 W( w
* z+ y. U, Y6 W3 i1 ~) L Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ T: r, n6 R: z( n * {$ D4 n7 J7 n" S5 Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ L; _' s% x( R( x
3 X7 n! [/ v4 b Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 1 t5 R9 r e1 ~2 C4 y$ d
, V' O# u0 d/ L$ Y$ z% g 2 \9 g! W; @7 _# a+ {# d
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ @9 {: s ?, n7 l' ~5 J
- }$ B. g( T, N- D3 b1 Z
Ping statistics for 192.168.1.21: C: i9 g5 m- z
& B7 V1 z/ q" t1 ^3 \$ m8 n
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
* d1 f2 y2 i& O$ o5 Z. v 8 d- I- a/ Y0 F6 @' L+ E
Minimum = 0ms, Maximum = 0ms, Average = 0ms . u% H# v0 p4 D. D6 Z
# V, l+ y- I. Q
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
/ ^8 M0 R6 N: f; N% \) J8 g
% v/ l, s; d: |/ s% \ -n count Number of echo requests to send. : H+ H. l8 W) b0 n3 }) }) J! i( P
; [8 }. o, ^9 ~
发送count指定的Echo数据包数。
3 s7 h8 c( O4 g' U: A2 r. m. I+ v
* u6 h+ p8 W0 x6 U7 P 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ' N: u, Y' H% `
' w+ \) A6 f5 D# }0 w# z C:\>ping -n 50 202.103.96.68
3 |) @, b5 B6 g, |' k5 Z& X: q' `$ [ 5 L- x: U5 d- e" B0 j8 ?3 I
Pinging 202.103.96.68 with 32 bytes of data: ! X6 ~* i/ M6 ]- n8 [3 ]- M
# \' j4 N a0 e) e8 c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- ^9 p: C9 f; P( U
8 g# h1 \$ f" @8 ?6 i& [+ Z8 h# [ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " d9 u6 u L8 p( F6 ] p I x
0 _5 z, P* x) k4 C
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 ~" z5 P/ I5 p7 R4 {
0 e3 l1 {4 g) |% Y; F2 y, b* B/ s Request timed out.
( G+ p( y% f0 d
) s- v" @. G3 c% w9 H ………………
' Q& V+ |( L- u3 W4 o & ~8 h \1 [1 G( O) [: L: ^, d& q( }# f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 0 h5 ~* z9 r6 p& l
d7 ?; B( n9 b Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% t4 m, _6 [+ |! p1 U& d% X2 m! ?5 K . @0 T7 v Z$ l( j
Ping statistics for 202.103.96.68:
* U+ S) ^, L2 d5 I1 o4 V" W
# }6 U% O7 i& `. p Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
& L1 \1 K, d$ X0 N
; b" I* q. X- z Minimum = 40ms, Maximum = 51ms, Average = 46ms
) s& P; I+ ^' |) C( d& P; X2 T/ A5 T/ ?6 Z 3 p2 w' k: u$ Y0 b* C! l
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 7 ?9 r+ J; B, A, t
2 \, k8 ?" m5 C$ t% ], n
-l size Send buffer size.
) w, b2 d6 h; [$ V6 W 8 o m3 u/ X( X, i* g2 d5 `
定义echo数据包大小。 |
|