|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
# c, H l% d; x# G, F& {0 q
7 x& C3 Y3 o! _6 u7 @ 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: % z) ]( k* E% b' `
5 A0 R( \+ G% W, d 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
. M2 t, i$ ?+ h- q5 A: @5 o
% @& j5 y; z7 K: W/ E" T& O1 j Options:
3 O2 l& k, G1 d% s. x9 T! ^
' r3 C" i, M+ T6 y& M9 @ -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. v. o% @/ f4 r3 P c, L
2 Q8 K7 T1 J" h
不停的ping地方主机,直到你按下Control-C。 9 k1 W' f1 i) `( q# i
9 C* E* P% R( a% \
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
% K$ E- l% h8 {/ B ~
# s) @; D9 X" P. E7 \% o% N* i -a Resolve addresses to hostnames. 2 K/ C9 C% A0 e3 _, U
* z0 T" Z( b2 ]* [& L# w2 @
解析计算机NetBios名。
. U% p7 X$ [2 d4 I 3 P' S% j/ ^0 c, ]! f
示例:C:\>ping -a 192.168.1.21
* h) B( a; T7 U
5 A$ O/ `& E- R# G6 y Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
5 b9 Q- R' P3 P2 h) g) o2 ]
; j% ?0 E; N& n0 P Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 A `% u2 c3 ?; c$ @) q) C
/ j9 y9 f* v$ n" U0 c' F Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
# A+ w, p1 }8 K8 c( R/ a " M: M, U. @- H: [: p5 g' h. {- ], B% |
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 `. o7 x; L* f0 U3 y I6 R7 O/ u0 G4 G3 r$ Z& g1 S# q7 l! e
* c2 s" ~ }0 C
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % D) N2 X% l5 N: e R, p
6 m4 u/ z0 f- H" \0 T( y
Ping statistics for 192.168.1.21: 2 y/ l! Y6 F* R$ \) b+ J5 D
9 C* c9 D5 J" A/ c
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: - p/ i0 l3 c( g
3 _4 }. R2 O4 e- {
Minimum = 0ms, Maximum = 0ms, Average = 0ms
7 \$ f% m- p% p0 d0 X5 E4 E' C 4 b* O9 g: n2 b: x/ F3 [
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 * u+ c* @0 A8 c# i* q$ e, Y
; a& J# S" J5 R5 Z n
-n count Number of echo requests to send. ' l' j6 B. g9 G4 R
# }. c/ R U7 E& |- c( a
发送count指定的Echo数据包数。
" ^; d' |" t: o3 v; O" O ( i7 ]/ k) \2 V, W6 p1 t7 c
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 8 C" N4 h$ L. i6 |% L: Y. v$ _
5 n9 l% M7 x7 R4 O% O- g; \+ J
C:\>ping -n 50 202.103.96.68
Q# @0 W9 Q( ^# j, |4 Q* R + O; ?5 A8 g' w2 s, O, F
Pinging 202.103.96.68 with 32 bytes of data: 7 z' P; H1 b% E; m% P2 r2 f
5 a) j/ t6 c6 u0 b, n1 ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 E, N8 k. @" _; _; |1 v7 ^9 t% j0 I
+ N0 ~5 A, o/ D! N
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; |3 L! z5 @ `4 R) w
# E* y( y: ~' T- ]! V8 Z+ R
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; e6 u. R3 s- b' i/ s
6 {* P7 G" g/ d- s# u; |$ u Request timed out. 8 k# j: E9 Q% J+ }* Z$ h
7 H0 z; C- z$ M' o# [3 D. \ ………………
) N2 i- ^1 P/ L
$ b2 e9 i7 ^; u1 F: h Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; k, R3 R/ c) k
( j5 t: Q3 |9 I* P* `3 k' X Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 Z4 ~( u' z9 n( P4 T1 G
* O. K9 ^8 |3 X% l m
Ping statistics for 202.103.96.68:
& F) b5 j' a) y$ h* y+ ]) x - X' X3 m; @/ `' w* w
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
* A, S; d; Q9 I: @* J7 a% K b
- E* x- j$ z; j! u3 s. e% x Minimum = 40ms, Maximum = 51ms, Average = 46ms ! F! m9 _; B3 \
* {0 \# D# H9 P
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
* @& m, P9 b& r$ X* c 5 f+ j9 y; d& I# G4 P
-l size Send buffer size. + J& ^1 S8 m, g
$ l; W& R9 j- c; J- `& U 定义echo数据包大小。 |
|