|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
, A `* V8 u% [" m$ E: }
, I; i$ ^0 [2 S6 ]0 w% T 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
# p9 w) ] A% C' G
! h2 A. F9 W9 _ 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
; M$ A8 n+ b9 F- S8 t+ `
" z( W7 R; }% @7 B5 L4 Y/ W Options:
/ f' K5 w2 l" U# o. [
+ X3 _( S/ H7 r8 {* H7 R -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
. Z9 z e9 F+ n3 y6 Q / S( k2 x+ w, v2 J y
不停的ping地方主机,直到你按下Control-C。
' i/ H4 }* k! S1 x$ K4 E' a 5 y7 F3 H6 w* d; T* \' y
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 4 h) J; ~3 |- L9 B% E; l
6 D9 p% d2 g$ n/ m5 [. U. {
-a Resolve addresses to hostnames. 7 Z" |2 X, Z. ~% b1 @# X
$ k" `4 R; c# ]2 I 解析计算机NetBios名。
B7 v7 }) j+ b; L6 e. ] 8 k9 A& {6 Q4 J# d5 d
示例:C:\>ping -a 192.168.1.21
; C' W; C/ q/ S, H7 G" g
7 Y+ y% d( Q1 ^# |5 x: Q( l Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: & }& G2 N( J5 v1 M, ~8 S% a
9 @( d3 {' G X: B' |6 j Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. C; ^0 }7 O, i: U5 ]; Z 4 }/ k/ j( ^9 n& f8 e% f
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
) T9 V, s H- y - T. b1 A/ {/ a" x, H" T3 c- G
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 t' c r& l! h; v: I+ E2 g) ]
; f0 o, y9 r% Y) U
3 F, i8 ~1 d* R4 l' |* c
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. g8 o; ^& J1 u+ s 5 z2 J1 c' k. G6 w% A# E; \6 J
Ping statistics for 192.168.1.21: * N0 R. Q: u2 @$ D/ b
" n7 D* I6 n& X7 ~ Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
T' |5 u% i# U3 a7 o M, h
- K/ ~) d* m# e# v ?5 f+ W Minimum = 0ms, Maximum = 0ms, Average = 0ms - R" [, c$ Q9 y$ _- L/ J5 i
5 p8 W( U8 [6 [8 u. Q% F
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 $ X" ] w( U L3 [
; d; b. M/ N8 a! d -n count Number of echo requests to send. 0 ^- ^$ x a8 x2 A# n0 n+ z
9 ]+ V' d3 M" { ~* u( Z6 I5 u: | m
发送count指定的Echo数据包数。
! s" M1 w, M. O6 }" Q+ d 8 U; ^. y$ l# N0 K" h- q& J
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
7 o" J7 {: M8 \( D # X+ i& B; z T
C:\>ping -n 50 202.103.96.68 & b0 W5 E- e0 r$ ?8 F
5 |/ i; ]7 {( M3 w' m
Pinging 202.103.96.68 with 32 bytes of data: * v6 E8 ^" P" a- u
$ u7 g# H, p# Y' X6 }4 f, l
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 7 I$ Q5 ?( W5 m6 H5 k3 k* [
( ~* A" N2 P% Z' n! {
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 `; E6 i6 T1 q. S1 ^* v. y
# }* L& {: q: s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 8 A. c# Y% R' ~& x
3 g/ \! H# j# O: j5 n* T Request timed out. 2 Y- L0 Y6 M/ T. w7 ~; a# m" e. }% o
! B; a U% g7 l J* V
……………… & a7 E/ e9 l S/ U( T- ?* v, o
8 I6 I# h$ e" N% t2 \, @4 t2 M' L Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
% G9 b7 O9 L+ j $ ], `$ `* n7 Z. A' g) b0 G5 ~* {) k
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ f/ c, j2 _* K: j3 W
- K9 w' I& `2 w4 q Ping statistics for 202.103.96.68:
5 b; E" H* J- L. l
0 b# G! y) ?1 c* q: U& Z8 M Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
~" c% s @3 }( e8 J/ S v: s. l0 g 9 V5 d- m" Q2 R" `/ q: C
Minimum = 40ms, Maximum = 51ms, Average = 46ms 8 u m8 _ u3 ~, m* r' T
% F4 R1 D- c! U( R7 c; X# ~: r 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
' n* m' e4 v5 f* F& u2 j1 Z9 a: L" k
- q; N a5 Y' e0 Z3 \ -l size Send buffer size.
$ \7 \) G. T, u( l7 x7 L2 j . O% m! W5 q9 e1 }5 j
定义echo数据包大小。 |
|