  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
+ P5 M& O9 ?( l& u, D b# g9 z8 V M. G! R- }& R3 M
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
3 g1 `; M" P J5 ?$ |
" h- h9 n- f$ ^0 n 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
) I9 p3 T" l- l$ x4 o+ G ; H x* L( a' d
Options:
( c8 u+ s* p" A) | ) s) h% T3 G M
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 d$ ?* c5 t) k, D' A4 k
9 k% B! D1 |6 H8 L* |' L I; o4 C4 g7 G
不停的ping地方主机,直到你按下Control-C。 ) F& j R% ?* M
( H ?0 L- [) I1 V6 q# v U 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 C9 e/ t5 y, ~& y
2 l6 X( l# @% S0 t* d
-a Resolve addresses to hostnames. 6 k* F' w9 Q8 I0 E# j% `7 U( u
5 R; O; t) J4 P6 i+ A: v* N! Y1 P 解析计算机NetBios名。 + d6 ?2 Y `3 u. q6 o
( z) D# R! s6 Q. l
示例:C:\>ping -a 192.168.1.21
$ L) ?" R1 \* R" p0 f! ? }6 f
7 G& [' {: d7 b8 ?8 |/ @7 V3 D. w5 Y Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: ( z; H% H( b! w* W6 R* A8 B
0 J; K/ h+ y9 W9 i3 h" L6 P; W
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % R0 r9 b, U1 ?/ h) {* X) V
6 |: d' }; n L& f; G" W
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% [& T8 W) I+ y3 c J) V9 X : w& }' B! Z0 y. ?1 M. ?* N
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, J7 O8 y- \; \+ [; T! _1 o- F s7 X' x9 p
4 p0 L5 w6 f/ Y1 y+ v Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 6 P0 z' i" n8 M+ i
9 j. p3 s2 K9 o% s$ x, c* [ Ping statistics for 192.168.1.21:
( f: [! J" I' L6 B 6 q& ^, ]& r) Z: O6 w$ w' J* u# U
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 7 y- h h. i. N& E/ m6 C
* |4 H" w, n: G Minimum = 0ms, Maximum = 0ms, Average = 0ms
/ S" u1 B1 T0 ]5 w8 S9 D
/ |) F- i# e) O* r6 A 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 : m+ U% f1 F/ X8 k# c
) z0 o4 [9 i0 h) L: E -n count Number of echo requests to send. ; ] L K$ s) B9 S4 u! U; j
+ D! Y$ g5 n5 d+ W 发送count指定的Echo数据包数。
0 _1 L2 y( p2 Q0 m3 U/ p5 o+ y% Q
" ?0 P. w" |% ?! z, d3 D1 u+ h 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 8 u! c) m! L/ g2 [! m' [
# h! P/ p4 x9 B# W; _4 f' y C:\>ping -n 50 202.103.96.68 - P7 q1 o" O6 i7 J
+ u% h7 z3 g( A# d1 U Pinging 202.103.96.68 with 32 bytes of data:
! U! N& o6 l* D6 z- b u6 n- O
- D9 s- J9 D2 ^ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( R! w! `2 ^7 B" n* e( t
5 A$ q! S! r0 q Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & e: [. I- Q/ `5 x( X4 U
! ]. f0 \+ c( Y% h# h; p; M F4 m Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; M" b2 g, H" @6 H8 D
: e' F- `7 K. {# Q4 S
Request timed out. - K |) ?) Y( h$ N& {2 ^1 g, |5 b
3 F- k1 q) c7 _' x% t8 ^: b
………………
+ {6 e6 F; L2 u1 r
7 \( N' w* `1 x' y; `2 J- n Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' H: m" C4 v- H3 m6 _) N1 A+ L
$ \( w$ Z9 u" F0 ~: f$ g
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 y# K2 o6 j) k6 F8 P
# i4 V0 a9 `. T/ L) y$ I
Ping statistics for 202.103.96.68: 4 x9 W& K$ I: z! f
( q, N* Q6 U1 g: a: [$ [5 N+ D6 Q& j/ U Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: : G+ ?3 z7 {( [
! P3 c! Q3 l$ _! {8 }: |$ s/ x Minimum = 40ms, Maximum = 51ms, Average = 46ms
7 g, n5 E, S$ c$ Y 7 D* X2 ?, Z& Z- q8 u- B4 \$ _/ L
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 : k: A: y( H9 g7 @
: p, Q) T6 L# e6 u' o1 o* K
-l size Send buffer size. 0 @' `# C' p/ v
/ g6 d; e2 u, j# @, G- o) ^
定义echo数据包大小。 |
|