|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
. a. s0 J. r1 e2 {9 z1 }
R0 d$ A0 O; V! s7 V0 k. [. X- Y5 x# i 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
- z8 m( `# j0 P' @% d% D# A : g+ r9 ^" `9 J+ f" L1 C- 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
, L( K E# z) G7 X4 }' X
$ f; X! T2 Q# C/ h, y J q. F Options: 1 O4 L% \5 D# e) P* y- ` L
) O4 ]- {7 o* Q" k8 c) ^$ K+ s -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ; T8 t: U, g3 z+ a5 C: y
g( ?1 f" w2 f$ c; s
不停的ping地方主机,直到你按下Control-C。 . T5 A* |, s+ H" |
% O) a! y6 r- C5 R# e0 t
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 8 n1 u! j7 q, K; _1 R
! e, ]% m- N0 I K, ^0 j: R( s -a Resolve addresses to hostnames.
" S9 P$ t4 |; N+ p; N$ s% t+ \/ i
' R3 H4 D0 [9 A# [7 u$ @ 解析计算机NetBios名。
\7 G$ P) ~* o, }! k3 x' A ) c# Z8 H: {1 X$ x' ]& _4 v
示例:C:\>ping -a 192.168.1.21
' j: `' E* w) R' k! \2 N9 H2 {8 G
1 b* ~. B/ l2 S5 m Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
- Y, N3 D& q' a0 Q
$ W" p7 q# z" v r* j$ Q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
& |( l9 I8 h( A W, k$ \ % x+ ^6 N4 A- T( L* n8 g2 h' t b
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 7 t/ N: J1 \2 o3 Q/ ^
- X) e% M4 s7 [
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 : z+ H. B5 y7 A* @# _/ p
) j5 l e3 D& _2 ?$ T4 \
$ E/ \$ p: {5 v9 q Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # g6 G2 ~6 q$ m# Z8 u u
: D% a4 U& H! u/ i Ping statistics for 192.168.1.21:
* S) c; c. I) V Y5 O$ G2 K 1 s/ `$ n9 t- Q
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: / @* W2 } A, ]5 b! m
) |2 f4 Q9 T3 ]) }0 r* `
Minimum = 0ms, Maximum = 0ms, Average = 0ms
, i7 z+ b: Q2 Q9 W n9 C 0 o8 i7 K7 l) i5 v
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 j$ _, v% ~3 b' c
: T4 S* h0 x9 ^ U7 A -n count Number of echo requests to send.
$ U; S7 i, t1 ?+ T, U) j) O ' {' x; h1 F' l( v
发送count指定的Echo数据包数。
; v5 i. ~$ E4 `. X" ]
/ m/ S$ I+ ?5 y y+ h 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 8 ^3 f1 q M# ]; p" [
* H; G) t5 W v9 i1 f- _
C:\>ping -n 50 202.103.96.68
: n) } a) g& U% c
d& n, G/ b2 ~; f Pinging 202.103.96.68 with 32 bytes of data: - |5 I( A/ \3 z) ~, N9 t6 P6 P# F2 t3 N
, P& G, c w+ W! n, @9 _ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 P5 }! G# W5 H
* ?9 t( d9 R0 q. f Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% L: B( C8 b& \& R5 I7 Z# R
$ g( D; L+ n9 {$ n Z Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 T3 b5 I- `7 Y' e' _* y 8 r$ E V; P3 N. |, a) Z
Request timed out.
8 r$ n4 M* x- [8 K# ~: ] 6 W* A0 k$ a1 z+ [% Z
……………… - D. P9 ]+ o' | D; g. W/ s) g6 F
/ m4 E D+ `7 t8 Z* a3 q9 w
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 H. k5 I/ f: e5 M. O8 X- n
7 Z+ e' ?8 a/ R6 A Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 , G% A6 v$ \7 C0 K5 H9 y# V! h+ o
! }& n* N( t+ {% c3 F Ping statistics for 202.103.96.68:
" e! l1 b+ `9 T/ ^8 Z0 r" ~( @ # Q% r+ ]! x+ P1 Z( _( x a0 G
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 5 ^7 Y7 E3 \# t
1 i2 F X* R# D* f3 H1 m Minimum = 40ms, Maximum = 51ms, Average = 46ms 7 Q' |7 N1 P/ n" b1 W4 E5 q
/ L3 J1 b! S+ I% J) x% A+ e5 e
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
. Y% P. I# l0 t+ Q/ v- N
. e6 b# q2 W$ G! {: m! N -l size Send buffer size.
4 i; c( M) b, [7 U
3 A- L3 y3 ~* A' U# e6 K1 y q1 L1 V 定义echo数据包大小。 |
|