|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ( \7 ~& k2 O5 A$ y' T
. _( @* n5 p+ w% `2 _, j9 \% _8 \4 s0 n 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ) b M O# v" M9 B. t; E* z
8 t: M5 p5 Z' V 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
8 j" `9 F9 G* Z3 A8 W$ l0 N# i
]. ?% Q& u& ~5 z Options:
+ s1 y' q4 H$ m3 n' O7 E
4 H0 e$ `( s) \8 q, P0 A* P -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. ( [( n, F5 T- \' f
I/ P. P. z d7 B, U& c
不停的ping地方主机,直到你按下Control-C。
/ Z+ ~6 t! y/ s2 G# h
6 r9 `) A' r8 u# s 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
4 M0 @0 c- ^; o* J; J
( T) s% R" ? U& X L( v -a Resolve addresses to hostnames. - x4 T) ^% _ \- }% U/ U
; B0 G# u; l& P! C5 Q. P, v 解析计算机NetBios名。
" h$ Z. s' u9 [) N# L/ D ! p7 \0 w& v+ D: U3 \4 i
示例:C:\>ping -a 192.168.1.21 # g" y% e- s! S6 Y
: Z# V7 d) O+ S+ z
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
" ~2 r g9 [0 J. y/ y : L3 P. ?+ A0 l1 y" d
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 2 }+ J, z# R3 j: [: A
5 U! G+ y7 [' }4 B% I2 Z' m( G) J Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 k; r. Z, S9 S/ H9 W9 K
9 l5 v. ? I3 `& S K- J! G6 R Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # o( Y; P4 G- B) z9 G$ y$ o5 K' y' g
4 K6 A9 {* P9 E$ d- F8 Y& e. @; \
+ z' E. {: a8 |6 H! m Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
C# R5 z1 R9 b, B# J8 _ * O1 Z. Z& O9 X5 J, D! ]
Ping statistics for 192.168.1.21: 7 n, J0 O" y+ @) [0 L* j7 a
* R5 ]* u1 Z6 _0 o. b; {5 ]0 T
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 5 k# d. M( H5 P+ F4 Y, d
+ q! q9 J/ }2 j6 p3 T' ~. } Minimum = 0ms, Maximum = 0ms, Average = 0ms
U0 }6 a! C: D1 {7 V4 ` $ O; ^3 `& Q& K/ ?" F
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ `) F9 f v- ^* e( |! t! i/ g- W
$ J" G2 x! E9 K. J
-n count Number of echo requests to send.
7 `' f( C; x% v3 ~6 ~ 2 L; R) R# _/ W5 c
发送count指定的Echo数据包数。
- ]* P) C9 ]* O( Q' S- v2 @
, D' W3 L% b) J" O! P1 p ^ 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 1 ?% p" v# }0 t' V* {3 t
; @/ O. T! y( y9 o8 s) E; P C:\>ping -n 50 202.103.96.68 4 M9 `9 E0 u2 w2 _
$ k. Q9 y0 K: X& J" L
Pinging 202.103.96.68 with 32 bytes of data: ; v- J+ R" `3 a1 q/ m
8 C9 |2 H% Z. w% ? Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 ^# X( y3 h T9 \( s: x$ I
7 E% j& u) Q$ d Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / q2 s: m2 p; L* d0 R
" J9 K% `. x: h; G1 Y4 w% Y7 Z' j Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 + h5 c: L0 c* m% a b3 }! }+ e( ?
: @) K) p' T- H8 g( {4 Y Request timed out. ; t3 x+ r m3 X, _$ |3 F
' @' a0 G( n! I4 d6 B, w ……………… 3 X8 B; V* F$ K$ J; T- M5 k
% I9 e# n! `" ~- M
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: ^7 b9 |) N e% b 6 y5 z0 I) O* h' J- T1 y8 @
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
y+ q; l+ q+ g8 Q
+ J! m% {) E* D/ |! }3 m7 @ Ping statistics for 202.103.96.68:
7 Q1 W7 [8 s6 s& W3 q 1 o$ P9 f T1 o" s% Q1 R3 ^+ ~
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: * d% R- C- p q j5 B
E# \. z' G5 N6 e [3 e# F Minimum = 40ms, Maximum = 51ms, Average = 46ms
/ h3 z9 J/ b6 L4 w- [. P 5 Y8 T, W# u$ d2 b0 z8 J" f$ L$ R, `
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
E1 o8 `2 x6 \# I 2 P0 s; M7 R2 H, B2 g& _
-l size Send buffer size. 3 Z% ^% g1 K2 t! t4 X2 h& z
, M z) K; y& q7 P& X 定义echo数据包大小。 |
|