|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 $ e, b+ ?( ?# Q! o. A4 U0 D
' h; M: K8 G9 @+ R& I
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
0 q7 `/ q' r5 k3 k
8 {* A/ u7 o3 M! 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 N8 R! n- u" i. k 2 v8 t2 E0 d; h
Options:
' {( v7 s4 h6 a6 b5 J7 u: d 0 S4 b( s% B+ A8 X& A* p
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 5 h2 c! f9 Q7 y3 a. T' ~% O
; r9 U7 D( m: [# \/ L& Y+ Y 不停的ping地方主机,直到你按下Control-C。
! P8 n4 h- E3 G
8 T/ S& e( @# r1 u6 ~ 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
. j8 g* T( S7 V' G1 R" c% E
8 R. z" h% Y7 t5 s; s -a Resolve addresses to hostnames. + G/ j% \2 b( G6 X, b
~- W- \) W, K# W9 W: ?
解析计算机NetBios名。
0 G3 o/ H8 Y) K+ S6 P : K2 p- F4 S$ K! M
示例:C:\>ping -a 192.168.1.21
2 B/ F7 E* o( N. D& c0 o1 w5 ~2 P / m- \ e; N7 j
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
8 Q. X# q+ w' N% t $ Z1 ~6 X+ s/ N/ I, s1 C* r
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
+ N' y/ v k: d# G
/ T' J7 m4 [6 d d Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( k6 u1 g! C' D
% u$ O! @' h( M4 J9 w Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 ( ?8 v: P1 z( A: ?! R4 ~& ~
( u' [( m7 j3 Z9 p- H, {
* S2 D* g5 L" \9 e; ^
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
; [4 Y0 C# D0 S' X( {" R0 l) v
$ j0 j: p8 Z7 A0 a" \$ F4 x- J5 E Ping statistics for 192.168.1.21:
* P' p5 z' G7 G7 a2 L
7 i$ p$ f/ a8 N6 y# c; g U Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
+ |6 ?9 c: X4 S& s , m9 p* e$ d( Q
Minimum = 0ms, Maximum = 0ms, Average = 0ms 0 A* d8 D8 } ], C, t% n# U3 k! n0 a
8 R" U/ R4 B/ K- d# c5 r6 k$ g 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
/ K6 e) [! J; p" a7 \ ) L3 s6 ?) ]% @& p) K" |
-n count Number of echo requests to send.
6 k9 V; d$ U; O' J, `5 }0 { 6 f! H3 z& O2 |$ B' t* W
发送count指定的Echo数据包数。
4 {# I/ ^+ n# j, a! U( E
7 I0 [/ C* J! ~ 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
- S) x* _$ F2 e7 x+ L! b
2 n9 D0 R$ ?, T& e4 y C:\>ping -n 50 202.103.96.68 8 d$ m, b4 T ^( m4 _
' g0 M5 K* a" U Pinging 202.103.96.68 with 32 bytes of data: 8 {9 \9 U; w6 Y- k: l4 D0 P. W8 D$ {
. V7 z1 y5 i* c6 p% ?1 j/ j; a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ' g/ C- I2 b$ \
4 K2 i; {* Y5 ^ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 ?7 M a* p! v
: z/ V0 r8 \$ m0 |/ \ Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 % n! I) o% \; S) I' \; p
; P! C, A/ B# r" J( H& [
Request timed out. - h' G( K! q: q" b1 r
& N5 O# _* `; Y" O/ y
……………… 0 D" [2 s. l3 Z- w
# a9 y+ `) A* s% L Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
+ j( R) c6 L K5 U2 ~& ` ( ]3 w9 D) M/ G6 S) B: c
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
7 Q) `1 }# e: k# B' L( P
( ^4 C; `& B; w0 ^1 r Ping statistics for 202.103.96.68: 0 n5 f: _* t( {0 N' x
N+ ^8 ^! j% M' k% g! X7 V7 ]0 k
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: 3 \7 c; X4 B8 e) s
# e1 n, ]. E( A7 n6 E
Minimum = 40ms, Maximum = 51ms, Average = 46ms
& F( c* {) b# p, w5 b L 8 s f. W h/ T) ]9 f& r$ j2 ]
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 $ r) f5 [$ u: n" n6 O
9 `- h9 O! |" |. b" N
-l size Send buffer size. 8 L4 [1 K6 @" s: Y0 m* D* W$ e
2 o! s/ J& f; W 定义echo数据包大小。 |
|