  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 0 J- ~5 Q/ d! Z$ a* Z
# x, a. }) u* ]# j$ J5 _2 L 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
& v- O. I2 I' J: j" k6 O
0 X' _6 C) g% y3 ]7 k6 Z 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
( ^' {, s3 b+ G 8 I9 ]) m. v. `+ r9 }, H0 r1 o
Options:
, y9 y( {# G1 H
( @2 x; \ c* D+ Z4 y3 O( g) Z -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
8 h, o: h8 \4 _. H% w
& y' c7 ]# I3 l. c' W+ ^ 不停的ping地方主机,直到你按下Control-C。 * R+ X# y% F6 K. v J* n. [5 g3 ?
( m) J- C; J% f7 d
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 $ ]; D: o# t) j8 X, w( Y' R
$ t% _5 h Y! N -a Resolve addresses to hostnames. T# p2 w, T( `- `. u3 S+ Q
/ g6 R7 B. h/ A; v+ n+ p* Z, i9 M
解析计算机NetBios名。 % P8 g; b; G1 h8 o2 [
6 k4 ]5 E: A& N* m 示例:C:\>ping -a 192.168.1.21 & U; B8 p8 ~0 C' K$ ]
9 w' N' I! b( h) Y; w Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: o; j$ @1 w: c* V! v8 A0 D& m
# @' R9 ~2 A5 q, X7 w u( n% W8 K Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( K! X _- |# n7 s2 u R8 j y6 i* l2 @7 H1 n
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
0 M2 ^8 n/ m$ S& [! w
2 f% \9 y; H6 I* X Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 - o$ j$ t- a/ P. ?/ ?( _+ C% [' \
7 J- g _/ [* O1 b ' ^9 j; V) B$ d$ W% N
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ D' `. c) c/ a, _" x
2 a4 y$ Q- \ s& a/ ]+ R( w( A Ping statistics for 192.168.1.21:
9 }7 {9 D1 Y$ E: n: ~
: P/ U4 `: L# y4 v' Q4 L' X1 h* a( r Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
1 d* B1 v/ s+ F& I . F$ k" K9 c. Z7 J' K
Minimum = 0ms, Maximum = 0ms, Average = 0ms 9 g9 @/ v5 h7 C+ I8 q# r# R
: U: `9 Q8 O* {% {6 C
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 3 W: ]2 _5 ^8 E J. L
: P) z* _ I/ B1 K8 {( [
-n count Number of echo requests to send. 7 j' l) O9 L3 G1 L& X
: v# ^! R7 ~/ j' S 发送count指定的Echo数据包数。
; R7 o: ?) y8 i" M3 {9 g
; _$ k* A1 [1 N" i2 F j- ~) N 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
0 |9 w, X% N$ F" y% E$ D) a
- N) m* O/ H/ _$ ^) C C:\>ping -n 50 202.103.96.68
2 M2 P! I; M; `$ C1 | 0 ^( Z6 r* l' R1 c+ j' q
Pinging 202.103.96.68 with 32 bytes of data: % a4 {+ O" x4 V! J
: [4 F" J+ S2 P1 @5 Y Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
9 d3 n* ?% C5 q2 |* a$ I
( u- H# A" u+ _ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 |+ k3 R) e8 W' V( u5 S: N/ ?
) b1 o g' C7 r* l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & u8 I% {7 j s) q' k6 G" }
/ r1 K. P, @3 q& q
Request timed out. 6 s% p- t8 H+ ?- Q* u! @
; c3 Q; N/ n6 T/ U) E ………………
! x* Y3 l" A' `$ h/ o
9 F" w S- }" n Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 o. ?8 ?5 N$ i* f' n
1 F- l% R" h. ~1 k1 u Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / Q4 w, F$ D) \! B/ o1 Z" m
9 [1 y: |2 v9 i9 m Ping statistics for 202.103.96.68: 7 \+ ]+ f5 V* D- J5 n
% S" [5 C. I. p Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 3 u9 j- |: ]' q) h
' k0 T: V( j. [, `0 u } Minimum = 40ms, Maximum = 51ms, Average = 46ms
, w2 Y+ U; j5 Y U2 q4 g+ x: |& G4 J
* N: _! y, b# P: D( A. H 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
2 @$ [0 L& a* \: O# x8 ?8 v
) {8 u' y' E. `- }0 }, Z. h -l size Send buffer size.
3 Y# X: G0 Q- m7 {- O t" J; R! \7 C( X" N
定义echo数据包大小。 |
|