3 h/ P: n) ]2 n) G- X 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: # v) |/ l% o! z+ J4 T& [* x 0 u K% G' H Y 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 0 ]6 a, D6 l) W+ P
1 e `+ W: t* {* c4 v
Options: + b; D5 \- _4 U& I0 M, p
- u. N- r: [$ o7 ~* f -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. 1 \$ x% ?8 M' _) \ 3 B" _; Z( G+ B4 ?8 w( a! `; B 不停的ping地方主机,直到你按下Control-C。 ' l# E) d$ ?2 K. Z
/ L* X6 p+ E) O+ B2 l. A+ k2 } -a Resolve addresses to hostnames. u, s! v) f) J# g: a) V
1 E9 l3 v6 R {" a
解析计算机NetBios名。 , V. J' x! a- |8 ^- R0 D' P
2 K) [9 o8 {4 i' F 示例:C:\>ping -a 192.168.1.21 ( g5 S5 W1 u% ?, T" ]
6 G! J N4 v7 P0 q" A+ ]( Y- Q Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 6 I4 V1 A" C6 P1 }1 Y 2 k) ~) R. d+ e c! o# k5 } Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 5 q9 t- W% g0 ?0 \' g* F
0 n" ~! e Y- b; E Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 , S7 }- H' N8 E
6 O' j) b% H2 ^" A
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 + R N$ |% X- `/ D# A7 O 9 t- i5 B* T# m% l1 K @# y. ^0 H5 Z& m
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 4 C' l6 \4 ^ U# i7 G8 `
& C' V$ R( W5 t. Y4 o' I; w G
Ping statistics for 192.168.1.21: # n5 p6 ^2 V0 q/ z" T% L# v
; R6 q( Y' L8 T
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: ) k) |( o2 \7 y) ]: D' @$ x" {
% \, h! h2 N+ L% i( c8 t Minimum = 0ms, Maximum = 0ms, Average = 0ms ( \: W" k* s d' y# R
( A! A2 V5 q+ ^, [3 b 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 # {% E& G7 [. N* a 7 K$ q2 F1 J: L- D9 D" y1 ^
-n count Number of echo requests to send. ; N5 c/ _. d- e 4 m' R1 ^2 P- d- f6 e, c+ U
发送count指定的Echo数据包数。 " Z: e# u+ S9 i# \! W0 v' i1 c! P 0 f+ O% X4 ?( p' Z. t3 e; K
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 6 J1 K' q5 N: Y: B& Z; L9 b3 R$ C: \
9 Y+ V! r1 E- c4 ? C:\>ping -n 50 202.103.96.68 7 J6 l4 f" i( g3 S S! n" [ " {) Q6 B; G) |. F6 W$ `: r
Pinging 202.103.96.68 with 32 bytes of data: ; T. |8 L; N+ x" Q5 _ 6 p3 C4 ~2 S% ]3 D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 5 n6 ?# }0 ~' I+ F9 r
5 F: g. }! `7 n! F, D S
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ) p( ?1 G& Z$ B& H
}- T# x, C' d9 e% m( N8 |* ] Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . ~5 G" i/ z7 J6 ? 8 l1 Y" C- J7 P' n Request timed out. - S7 E e* p2 z+ l5 I ; g8 V @6 T! B+ D6 M, A# u
……………… }2 O% |6 t+ x Z6 Y7 ~
[2 j( |, W7 r7 O Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 4 y8 T7 c5 z9 m 3 G( n3 _" T% n' F
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " J) w+ C5 {4 J" H
R. Z) g; w) Q& @3 r) v
Ping statistics for 202.103.96.68: ; q/ Z7 X* m+ s/ o) }( w1 f0 y ( v6 p' o7 ~3 q. t4 g' N& I Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: ' d/ s4 ?( {9 U/ R
: I! s" o0 t! D
Minimum = 40ms, Maximum = 51ms, Average = 46ms , I! j% \. d7 ?. t; p
3 ~7 T/ E3 F. J( A
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 + r) M- R$ i! ^$ m: I7 I2 J$ F
w% x$ M' j9 @8 t) R! [8 K -l size Send buffer size. $ X" m3 X: O4 o