  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 & i8 B. j( q. i4 V E
x( B4 |* t/ Y5 S" [
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
7 a" g' {5 d# s: s4 [1 W 0 w( O/ d3 h( l2 S! l
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" e/ h8 \- s& s/ e( K" z$ B
+ l6 \2 e; _0 z x; s+ ~1 F Options:
; F9 a% U1 @" u" Z2 `; f' ~ 3 Z* o) s A( O2 Q( {
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. $ I0 N5 N! K1 H, Q) t
; J( q4 X/ _+ t) N& M7 ~, d) E4 E) z
不停的ping地方主机,直到你按下Control-C。
6 _' p; T& S, }* k4 }2 [$ y! X: j 8 S3 e5 F$ F+ E) X2 h
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 j& I2 T+ n$ R6 t
% S# P" e- W! \7 Z -a Resolve addresses to hostnames.
# O/ _% d+ I: ~8 N
5 _0 H W! r5 i2 F 解析计算机NetBios名。
. Z7 ?2 ~& @) `" g1 w
1 L2 w6 D2 l9 j 示例:C:\>ping -a 192.168.1.21
' `' W$ h+ G9 p) c7 b2 X
$ h3 X/ v6 u0 A Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ' z, u0 t ~4 E4 }
, n! c4 e# Z- p% O2 r, V Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& G4 b9 o% {: F1 V
. K: f j4 E& O Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % w) N9 J+ ]( h% M$ o
0 U' I7 Y( r' q; z `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + ?' o$ }$ m) N4 a
* M+ M+ x+ \2 ]* G6 o
: D" P- l2 y) k& r% f Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
: B- ^9 m3 G7 I4 N9 e# [- f% U4 t : g7 s6 h0 H: z- O& Z2 E5 _
Ping statistics for 192.168.1.21:
# y* |2 S- g9 p& _* g # x6 }+ z7 u) [/ p8 g! M) {
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ( Q$ d& w, Z& U* C# \3 ~- m
6 |. t) F/ D" h; g a# H Minimum = 0ms, Maximum = 0ms, Average = 0ms # C/ `7 b' N$ P% |
' q& y7 \( g! J& L 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
$ A9 h1 z& q a2 J , `$ w" F! Z9 T* r
-n count Number of echo requests to send.
! Y( q/ h6 h. n% W! E ) i- S0 C3 N7 [7 i) F' m
发送count指定的Echo数据包数。 ; P$ S' P$ M9 w# e& A3 u4 c) l
: o$ w& d1 `2 I) e0 ]. n 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
$ b |3 y1 P, W0 \ # K h* O0 \7 Y) |# t4 R1 \
C:\>ping -n 50 202.103.96.68
7 _4 G8 S5 {- q
- z" j7 R6 y# [ Pinging 202.103.96.68 with 32 bytes of data:
& `* F& Y, R. _! j6 r
! k( ?# x# Q! }" b Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 a4 k% G* L& j7 C# \
8 A: u+ r' U& y5 a, \ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . f9 M+ e. a+ K: S
9 O) a# @1 O6 D) v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ( [ e/ C2 I: s1 v; `! c1 s
- V. X: L V7 ]& y Request timed out. : E! T0 P# M2 `9 L8 R1 `
6 A2 i8 |4 K$ L: @& i+ ]/ q- {' R+ W' D ……………… : f$ y W' o# V) d \3 O
% m* y' ~) }2 F ^: d% P* a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 b! A+ `; w8 N v5 U0 L6 O 7 l4 ]( {0 {- L, W- R7 S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 O5 s- P3 F( ]3 H2 x. n ' n( D( t, H$ U
Ping statistics for 202.103.96.68:
: l. p7 {5 a3 q) o0 Z% X* ?$ T
" J# T4 U- i6 e0 U Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 5 M( n1 L- \4 B( D+ {
: C0 M& B) o: c' j
Minimum = 40ms, Maximum = 51ms, Average = 46ms
. a- A- T# d* N& `$ `$ G! [2 b
- [5 [8 `$ h! i( x( W0 i 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 ' n8 s7 a: B7 n% h/ `
" G8 i+ K/ M; D
-l size Send buffer size. 2 f. f' W3 c3 S6 r( g& T0 ~ x; j
' g% w4 j+ B$ J/ m 定义echo数据包大小。 |
|