|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 8 `' s0 k2 y# j2 k3 }) l0 I& h( S7 h
7 N: y7 f: R& l, d3 N 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
9 a1 x! B8 }' E* O# S
3 u( M+ V1 }4 @7 h% @# E 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 ' o; W" {3 Z) F3 q0 P6 Q0 |: o. V
' f/ ]2 Z6 j P3 \ Options: & \# r$ O0 S% ]/ W" b5 p" V
' m9 T, ~4 k; N2 P, P -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 7 m: p. }# X p5 P' m
6 X1 f, K0 r0 |
不停的ping地方主机,直到你按下Control-C。 : J/ f. D, Q4 M
; k" e: R$ I" C0 M" ~
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 & c* x) K( n$ z! I& n( @1 R+ `
% z5 v( N' A, @. Z- q( n# Z
-a Resolve addresses to hostnames.
$ y6 A. @$ g+ [! V" i& V/ R2 q
7 z9 E" q- ]5 p, q 解析计算机NetBios名。
$ j+ O$ s ]4 d& d( R# {) k) U
, D2 r3 o4 e+ t; w 示例:C:\>ping -a 192.168.1.21 ) E0 f2 e6 ^( |
9 W% h2 H& A6 y
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: , T6 M6 h1 q3 o* }5 v+ i
6 P1 s. r8 G/ y/ w
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
% q& s7 T+ b" d5 e9 j ~( H/ e9 h$ e# Z7 @
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 [/ x! ?! c2 U5 \# }0 l
/ N. |; L+ C# X1 b$ J6 n0 V Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 z8 u* _0 h$ v% R, {8 W% {( d9 p7 Y- r5 K. T2 H
5 C$ B& f8 f0 r" S1 ]7 L* S Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / v1 S- ^9 c& p9 F
" W5 v }: ~7 z3 c2 P- ^' s Ping statistics for 192.168.1.21:
- \+ T* [! ^# n * Y" _: }1 `! S7 F1 X P
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
1 |4 m! |& n2 A% J: y# `; S
, ?( V! c5 D9 _( A- s6 q e2 p# N Minimum = 0ms, Maximum = 0ms, Average = 0ms e9 z @1 l7 x! E
3 J! t/ Q) a. y, q9 I 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
1 N3 t2 d5 Z6 k/ D
5 D9 Z$ J* d! ?& Q6 s -n count Number of echo requests to send. 9 ~, R& N$ {( R9 I! I2 K
5 J& F U+ J2 t! a* V s 发送count指定的Echo数据包数。
7 F( d9 b4 N! O* V% [4 p9 s8 q & X3 t/ A( B- C+ u0 A# x; f9 n
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
8 [. d% r1 v* O0 c) E5 \$ e/ [; o) v
: E/ @" N4 y( F2 ]! \$ ` C:\>ping -n 50 202.103.96.68 6 r% _. L u& |
/ Z6 e/ |9 H) Q
Pinging 202.103.96.68 with 32 bytes of data: ; q* i1 Y9 G2 T( o
$ t/ P- S9 ], d
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 g- j8 F9 m: ^8 }8 \7 s! g$ y
: o+ o3 m8 Y5 E2 T
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & G( d9 f: g) q
! i8 R0 X9 S$ K4 y, S3 ]
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 g8 U5 I* O3 T x. }! A, k + `2 C2 r: S; S0 q: B
Request timed out.
2 b2 O! O! c8 I3 I& M& F
( @% o9 H h- r7 @7 t ……………… * v! f2 `9 u5 q+ d+ M6 U
2 P" b7 o: M0 z$ x) ~ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ q4 p1 H, W2 \2 ~# Z& X, H
' Q& |0 T0 E+ x; @0 S9 | Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 $ D7 a2 y7 u8 z6 e
$ A' |! E. G* ^
Ping statistics for 202.103.96.68:
5 ?$ U! d$ R3 H8 G: F0 X# Z$ `" r8 P 9 L$ _3 {3 Q1 W: @
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 4 H9 f" C/ B% M
: s3 c. e# U: b' x" {* f
Minimum = 40ms, Maximum = 51ms, Average = 46ms
# v5 R$ T/ h9 D1 d) o0 d/ h. g1 n
# ^' ^1 U, f0 y* k0 N 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 9 E5 H; W5 M( ^0 l
$ \5 @! E+ G* T6 O3 R -l size Send buffer size.
6 [. G1 p: i: B* @
* T2 O5 ~* K0 Q# ] 定义echo数据包大小。 |
|