|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 + Z" C, c+ y& \' D
& U6 ]8 f; S$ p: T0 D1 B
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ! L2 D( x+ {% E
, ^0 i- b% m7 L u3 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
" {, ]: h3 p# a
! ~6 U8 D9 |% H4 N' E( h: v Options:
@3 S R3 @+ l
( Z [" [8 j/ k% K6 G -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 i# E8 t' F, H# t8 Z" \
) _7 m0 ?: @6 J9 o& B, F' o 不停的ping地方主机,直到你按下Control-C。
$ h) w6 W* N; @, q! m- z: W2 K
( | n9 K# [* h" u4 G0 Q+ [6 M2 F 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 % N! a9 {2 V1 ?3 }7 |6 x" e2 n
, u+ Z- P6 S3 G/ n- j' b
-a Resolve addresses to hostnames. , ^ H, I& h& ?/ S* v" p# X
0 D$ D3 ^) W2 J* \9 D7 J 解析计算机NetBios名。
# `' x2 b- J" F& j7 Q 9 V7 V. e* Y( t8 c# ?) j
示例:C:\>ping -a 192.168.1.21
; \$ g# X m/ u 0 A- K% J2 h" H% g
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
* o& q3 ~ ~% C
0 k% o$ s4 H+ A/ `3 D6 D" L; t6 I6 z# L Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 f3 c" Z& _! s: l
- q2 p" c% @" R Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / W0 u6 \3 ]$ T! E" E
2 P+ V5 L+ K+ U5 F" p9 I5 S2 |( \ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - n" J, A* Q9 b$ T, s2 `% \
: R- W' r2 c/ R6 X5 M
4 Y4 s0 G) b. E7 a P, H- o2 N
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 $ \9 w, ~+ L4 C9 r% M
. ^/ t( W3 ?* l1 n Ping statistics for 192.168.1.21: % o( u1 G6 }& U. H0 C% Y. a, ]: c
, c6 u2 v* Z/ h2 E/ l0 u1 }4 ~
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
3 R5 v V# J# W% s- v : o% s; T6 X( [+ u3 A
Minimum = 0ms, Maximum = 0ms, Average = 0ms
6 w0 N( q! S4 b 7 [! o6 O( e' T3 a) N
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 6 e4 f0 m5 N' P& S1 s# A
: w! ?, m) N3 c( T -n count Number of echo requests to send.
+ \- V' c' J3 Q3 S" o& f* k : k% ^5 S6 G4 {- K' A; P
发送count指定的Echo数据包数。
0 |9 X3 a7 y9 s; Z6 @$ @ c- b, q. X+ Z3 h- X! I/ c) D6 W2 o
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: ' U/ Y$ Q* U% D# a, s- S
2 h5 f6 [" j" J C:\>ping -n 50 202.103.96.68
% U) e3 Q% r" c8 ?; ?4 v3 ^# c + z3 Q( u) X1 K* j8 k; _# F% C5 M
Pinging 202.103.96.68 with 32 bytes of data:
) k5 ]( z9 K t9 D2 P 6 m, w9 [* n4 x/ O1 Q2 L9 f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 P) T" D A0 }$ m0 \
+ E& g: | M+ S) b1 D4 x6 t
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % x* E; C z3 y2 l `8 i4 ^0 i
O4 T8 T( E F2 N; U7 N' c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - Z! r+ o" H$ F/ Z- `
* z- V7 H4 X, i Request timed out. 1 U0 e1 ]# p" A+ A6 o' Z { t
K' S% T/ G1 |) ^- x3 D# y
………………
6 k! b- f8 ` U5 V* m* M0 @3 ^& y
+ k# l s( P% N! y/ R4 Y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ J! v7 [: _( g, s! H; {
. `( e% _; Z! w7 j. o( A Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 : v6 {9 H. a0 b; X6 V$ U6 _+ g
, L/ N5 [2 \6 _) l6 C' }6 Z3 u
Ping statistics for 202.103.96.68:
* g: y3 @% W: T" x! [% Y6 u
$ I" N+ l* s o1 b6 Q* H T Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
# g/ g- `: X a+ Q, X+ L; R
2 A: Z' d9 A6 i7 n U! o Minimum = 40ms, Maximum = 51ms, Average = 46ms
. _' K* f1 t, ]9 d( [4 d; l 1 _% H4 e: d. h! L
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
3 g5 k' F4 @& _" \) n; j
9 h+ U" [; d4 S$ J( P -l size Send buffer size.
+ `9 U! Q% Y3 Y; Y; Y ! o, e- U+ ] v0 a4 Y8 S/ x9 Y
定义echo数据包大小。 |
|