|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
+ v' J( Q; ]# B- g! r+ G* F M : b; z. z' {7 I. ]3 g8 ?: f
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: ( K5 q3 l# V3 O+ R g2 h
+ B2 J& S+ I$ R
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
* [( P9 U4 O W# f 2 r, X# g* J) ^) F
Options:
! S9 S: q1 W6 U5 ]. w4 L8 L. i / {; W6 B ]7 r# i' X' y
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
0 H6 U6 H* u7 B4 b
( W& c' u% R; Y) Z0 W 不停的ping地方主机,直到你按下Control-C。 G6 D+ n& g0 y5 O
- O2 u! v: O, ?: J v9 f 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 6 O: V# ]: E1 V! U5 q( ^& u, o% X
5 R2 ~7 {9 l- s. J- u
-a Resolve addresses to hostnames. 9 |, q8 n6 h4 c8 U6 o! b' p3 W
; n! D2 ~2 w7 h. v) P1 P5 D9 v1 ?* W 解析计算机NetBios名。 7 A5 I/ n3 g3 U. @$ U
. a& E! q! J# c- E5 s9 C2 [' Q3 A
示例:C:\>ping -a 192.168.1.21
6 D) k) K6 ~3 l" l( j- | 4 C9 ] x) W( U3 a) b$ J
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: # W3 j% s4 O4 K+ N. B
2 V$ _$ u& p9 q8 p/ V4 |5 }! d
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" [2 P. o$ O& B( a; c7 j
) S4 ~2 M' N/ e6 L( d, P0 T Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 . d) t( b) v8 n, t8 X L
[: G& ^! B# E$ U8 h- g) f3 n1 ` Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
8 z# o) D# O2 N! e
' M8 \" e8 R P3 t
8 m5 A- I5 A7 A3 [ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + F- c) E6 s) a) }# Y3 E% x, B8 m
/ {% r. a; |; v0 u$ [6 q
Ping statistics for 192.168.1.21:
/ D+ C, y+ b o, H0 z
' Z! I- t& R# E2 o* v Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: / [) P* |2 Y: r& F% W* T
. r8 T6 s3 Z+ l* i
Minimum = 0ms, Maximum = 0ms, Average = 0ms , O9 j* S7 U4 W% o
7 s2 f0 }" W6 [; }3 \8 \( s% @5 K- N
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 0 W+ A8 {) f% {
# d N" I. a0 [' k" N
-n count Number of echo requests to send. 8 D. P; X7 z$ M/ e8 [: e1 ]' p# Y4 }5 a
% ?$ B- Z" [1 o7 F5 s- w: ] X
发送count指定的Echo数据包数。 7 c& a& F% e1 {# r3 @
- p8 v+ y3 P5 }' {, d: W( q
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
( G" R; A$ B1 `4 `. f& w3 D7 n9 ] ; c" P0 R2 o3 Q) {& J6 B
C:\>ping -n 50 202.103.96.68
+ ~; u& q# V2 O2 ]. Q p0 k+ y w; C$ ~+ d& G u! r3 a( [
Pinging 202.103.96.68 with 32 bytes of data: 3 F0 Z# [" }9 }' Y) Q* e% A
3 t* n) D, A$ q* Q3 S$ n Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
4 C; T W; i5 j' Q1 n; G / b* O7 S5 ?8 S. s* j1 Q# A6 F3 Q r: p
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
' z) f) ^) r6 ]- v: z
! x0 }: a, Y5 J Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % ~( W q4 \9 O, K9 ]
) I0 ~( i% }* G1 N0 s4 N+ ] Request timed out. " i: N, Q, Y; M: O4 M7 ?& v# T) I
2 m0 y5 @; d) E! ]6 c5 j( @ ………………
: n7 g z* @% | t0 h # c+ X5 B3 g; w& ?1 f* A
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 t; J, w, V4 W0 U
: G: W; J0 O( p. u: ` Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / Q6 D: b2 i4 I. v& h6 r9 u
4 |: G# ]: i7 ~/ i9 p, i2 d
Ping statistics for 202.103.96.68:
) s& @! n0 W( K# U; g5 R. n/ k
4 Z3 O# d& X% O Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ( o- P2 K8 H$ Q$ z+ H
8 Z) }0 J6 V! i2 p: p' D: p
Minimum = 40ms, Maximum = 51ms, Average = 46ms
% o; s3 O2 u4 W* {6 l - J9 e8 D( U! b/ Y2 w
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
* f$ ~9 K& e4 b% t a+ H4 f
: u& a/ k, E! }3 `" C -l size Send buffer size. - ^0 x( R" k5 }1 K7 F1 I5 r
( P. z$ R$ t" V# _2 ?% h- {: ~
定义echo数据包大小。 |
|