标题:
教你正确使用Windows的Ping命令
[打印本页]
作者:
野人e族
时间:
2008-1-27 22:16
标题:
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
+ M0 h( a, c' w. @
1 b* h/ R& d ?; ?- Z
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
; C N3 I- s% @& D) _9 }" |
1 A$ r/ m+ @1 A# c5 Z& `$ Y* Q
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
- N. y% {0 q) f# r* k" I- ^
}1 J0 m% t' m p) f
Options:
0 Q' j5 V) S- K- f2 b& f. n
/ u: d; h2 r, O, ]" E! Z# }. L; `
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
- C" v; L9 X+ o6 H+ y" k
2 O2 e: s& _8 E
不停的ping地方主机,直到你按下Control-C。
& L% o6 [! l. M/ i
5 |" p8 S# U; [! j. Z
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
5 m& w' X, u0 |/ m
7 S" g+ Q; u2 n, X4 T% e, J
-a Resolve addresses to hostnames.
) R' T9 x, N; O- e
" t5 `$ p4 r( Y: F# r! }# ?5 `
解析计算机NetBios名。
- }0 S# S. L( C" B0 U& i
8 d/ k5 |8 ~$ ^' x$ v
示例:C:\>ping -a 192.168.1.21
& \- W* T( R% `9 q7 s5 j; z! }# g& x: s
- r+ h/ d" e- m4 `
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
. @( a# J0 i4 L! T# N. }/ q
* \: Y( G4 j3 @! B: ^
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 q/ K" J% y* h- t! q
P6 D& D% f b" K
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
6 {4 f7 ?2 L- x( m6 i
- P, |% o+ @( c3 I0 ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 }4 }1 T) q$ H: p
: n: K' p$ p1 U7 @% D
, T6 R: t: b* A9 `8 X
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
! S: S" r: u7 \4 W" } K; p
! U( a& c9 ^' v g: A& O
Ping statistics for 192.168.1.21:
1 \ N% {5 t& _ O
9 u; P+ c0 g! a* m# L
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
4 M2 w/ e! B5 T1 ?
5 B- E* V, T: N4 N
Minimum = 0ms, Maximum = 0ms, Average = 0ms
$ X4 ]! I* t" A3 A3 Q
& h% r3 P( N- B2 u6 ~
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
! i/ V' i+ a) }5 k2 u s
" ^, S8 `% ` X% h- ^3 J, t
-n count Number of echo requests to send.
7 R4 r" H+ T- I. ^. i" ~' E
+ l4 s0 o: V l1 e4 A* S3 x
发送count指定的Echo数据包数。
3 J' ]. v! A3 e1 u
) n# w1 x; e! A/ V, `" M7 S
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
% X. w& y6 I3 ?: ]( f; K# c: @* S
: m, f+ n1 u. ?: [3 B5 D2 ~5 e" m
C:\>ping -n 50 202.103.96.68
/ W* Y, c3 M' u/ B1 H
" x/ O( I1 Z- \1 q7 x9 p& n) n
Pinging 202.103.96.68 with 32 bytes of data:
* Z' _1 q. ~/ D) c9 b
- C( t9 d p3 O) S% C2 U6 _6 W
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ S! J2 T! \0 m& R
( Z) l- p# F, F( _5 S9 R. w$ |& Y
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
J/ P3 C( l7 A' F
* K7 o7 Q) S+ M" h H
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 O; v, s- ~$ U& R) S
; P9 y0 R' Q+ r3 r
Request timed out.
" Y0 G5 M7 r7 @, ^
+ ?" Z1 ~* H% U- t6 ]) Z' M
………………
, l( X$ @% x& L
E, r, ^2 G# x- w5 h
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 g5 X" J% l/ e6 X# P0 R O
" J+ N+ z( B9 y! K6 A" H/ j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
k4 P2 M1 J+ s0 F
- U/ l# J6 ?# M/ T
Ping statistics for 202.103.96.68:
2 I4 A2 w: W' H) _: \
; C- Z0 _+ ?$ P8 \+ D5 @
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
. N! n. B5 U; g. ]( r7 [/ m
" O% ?, B8 `9 N. w' o# E1 ~9 ~) q
Minimum = 40ms, Maximum = 51ms, Average = 46ms
7 b; e s4 d" } n
5 x" ~9 s/ z$ a
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
) b3 d8 Q1 g4 P' V- ?
& T; ~7 X& e. X0 x2 c& v; `( I
-l size Send buffer size.
2 E+ U! D7 c J; v. A
m% \% P# f6 k5 ]: }
定义echo数据包大小。
作者:
冷雨清心
时间:
2008-9-25 15:54
强大,但是我看得不是很懂!
欢迎光临 捌玖网络工作室 (http://89w.org/)
Powered by Discuz! 7.2