标题:
教你正确使用Windows的Ping命令
[打印本页]
作者:
野人e族
时间:
2008-1-27 22:16
标题:
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
% \8 \' E1 `; d( }
1 E# q3 J7 X$ o% \2 l: }7 u
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
# k' o8 W' a; z
" d7 q2 [7 c% \
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
; Z) j c/ y/ c' ?+ \- I
6 r0 @( W7 _( y0 c5 n" I/ ]
Options:
4 R1 @5 O: I3 C N8 L' J
2 z( C' z6 m; m9 M9 ^2 V
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
9 e1 t& k/ F. P1 q
2 k P( G: d+ P
不停的ping地方主机,直到你按下Control-C。
* I( ~; C2 v7 B( k) G: g
* M3 v/ E6 i$ ]
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
9 B+ t8 D: i. P+ P1 U
, y/ R: P$ Y1 @7 Y0 \8 q. w; d8 j
-a Resolve addresses to hostnames.
* H! w0 P" A: V+ S( A0 j( g" j
6 S1 ~5 _, Y; {& L% {, f4 D1 B# \; @
解析计算机NetBios名。
) i! f5 O2 ]$ ?! H" d
4 E/ N I/ T1 y3 K
示例:C:\>ping -a 192.168.1.21
; M, e0 @9 @! S5 x
5 R# E! g4 u2 u# m6 h( L- ~
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
# W6 D$ }% H0 U# ~2 P1 L( r; C, N
8 ^# @0 c4 k& d0 U+ ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; J4 t, C) p1 _7 q) T
0 E5 g* e- G5 p2 {9 q) p) |6 S* ^
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 b3 \' ^) C( \5 p" \9 U
E7 C0 O, u. p- J h
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' i. b2 ^% J; `- g3 Y
; U2 Y- ^: |/ D8 |* v& T
; s1 ]+ e% @: z; t& k. ^; n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
5 M& v9 U1 m* Z9 t1 u
; B! T7 d6 y1 S: W) U- ?
Ping statistics for 192.168.1.21:
: _6 n5 ?! O$ U6 B) T/ C4 A/ @
! @" H. S+ b- T
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
; c0 D4 w6 k1 h* k' a: V
& x J; R) n) }
Minimum = 0ms, Maximum = 0ms, Average = 0ms
( ?, c, W: S6 r( X3 f
+ N i2 y5 D7 u( y
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
' [, F" V( {9 g3 Q% A% }& v0 i
* Z" |$ \7 n9 @( Y4 m
-n count Number of echo requests to send.
/ c$ p; f7 M- h7 v, p
% y6 ]: W$ _* `$ p' b$ M' U
发送count指定的Echo数据包数。
: I# Z2 s& r, Y$ [9 v
9 X3 B8 S: z; T1 ~3 L! u E
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
* G2 t/ U" q1 o+ j5 o$ ^
6 y4 ]: B0 ]- M+ G, |4 P3 P5 c4 e$ [& r
C:\>ping -n 50 202.103.96.68
4 G# t4 J4 J! V" u! o$ p N
, E _2 r) V) W- k
Pinging 202.103.96.68 with 32 bytes of data:
0 T3 ?: |8 ]) m* {" {
# v5 s. O* q7 r- S( b
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 X& M& \& ^) J- C2 X$ {& x
$ I! u; }; `# t/ i) g, C
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 a8 \' @& X, P& z9 w: ]
$ i6 t* M* j7 O/ A) O7 [
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
" d2 u" a6 K' h0 I, J$ s
7 \* n( T- I8 e) p* o6 E
Request timed out.
5 [0 x$ g3 l. [7 l& n6 L: i- _
- m7 N m9 `9 J* k) r
………………
( ~. y, }* A' ` f
7 t8 I. i7 u( i) O0 `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
1 b9 @3 k. t% w7 F" B9 m7 n w
5 M) \$ {- _" r# e- x0 e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, b" @2 E/ b; ^# G" O
$ X4 u0 p" d! ^; r# o) n' R
Ping statistics for 202.103.96.68:
2 v$ L l2 b: r
% C# P0 l. K; q: a; j1 X/ O; b
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
$ O/ e" T" @" f
7 }/ f7 G' h* k- @. K5 s
Minimum = 40ms, Maximum = 51ms, Average = 46ms
- }: x7 F, u/ D1 U
5 F% W, e* u$ Y( D
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
9 f5 f& F, |5 u) ~
% b& n; }4 k7 d
-l size Send buffer size.
( H! {1 ?4 L. a* {
4 @& V$ ?9 K6 p) C2 f1 B- r+ w! N
定义echo数据包大小。
作者:
冷雨清心
时间:
2008-9-25 15:54
强大,但是我看得不是很懂!
欢迎光临 捌玖网络工作室 (http://89w.org/)
Powered by Discuz! 7.2