|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 a5 m2 D& _/ _, @" R8 @: p, r1 ]
$ o3 u/ E0 n4 M+ c) W8 N7 | 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: 7 A3 H1 t: @& r# e
1 Q! I' Y" O4 x/ h7 h0 a
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
/ i, { @5 A# b- b & z! A! g5 [ q: K
Options:
, W4 C+ M; U% }
% W+ _4 v- h: c& r -t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
) i! n* S2 s! e" E+ Q& n ) l, m0 S' N% v, V+ R9 S
不停的ping地方主机,直到你按下Control-C。
b H# t a4 W# R
$ r. Z5 C0 i1 M8 U2 Q6 X 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
9 O' Y4 w7 d/ Y: m' \$ A ; ~) U5 W6 P& i0 L' \
-a Resolve addresses to hostnames.
8 r* p, D! G3 `0 R; q: R9 G , G8 C1 C# ^; R+ d
解析计算机NetBios名。
: `: _$ ^/ b" D# V" _6 U
6 A) @4 W( f G3 F% y8 m 示例:C:\>ping -a 192.168.1.21
3 o1 Z: M+ q8 O# m l( _4 P Y & J4 j! [: s: o2 |; s+ G/ k
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: $ h4 `0 h; V+ ^7 R5 O. Z* M
) w+ s. O* G4 h: W. g Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 Q& K9 M( o: a/ \0 J
" M" o$ Q ?3 Q+ m* a7 A" @ Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 % I1 z4 y; h, d+ d; Q; i& D
" m0 D2 K3 H8 a+ _% b Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 / g" m8 e. e: |& S$ N
! m0 V; r/ ?* e/ N & t. Z0 W9 d) |3 e+ A7 }$ s
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 n3 I2 C$ J, g" ^
0 s! R' C2 P) R- M3 U4 C( ^' k Ping statistics for 192.168.1.21:
! g$ Z+ R1 W2 q# Q
1 C& i* N) t9 a% p3 W$ x5 ?, P Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
& {" l0 `4 X8 j0 |+ h& K
: x; W) e1 W& w$ b Minimum = 0ms, Maximum = 0ms, Average = 0ms
" q/ S' G K4 p+ d5 }
* S, {& B7 t* m( O& _2 ? 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 6 s' q! l6 k& }' r5 e, D1 z
1 I1 Y$ U; y, }
-n count Number of echo requests to send. # f& G; E, A# j1 j
% Y$ E/ a1 q; }. z( @ 发送count指定的Echo数据包数。 % S `! f! v) C$ \
8 O8 q6 }7 b5 K; ?
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知: 6 G) g9 R0 x L( s+ `# I9 W! c
' S j- i- S: G5 H [
C:\>ping -n 50 202.103.96.68 + L4 [' k3 V! }( x
! W0 l2 H" u2 A Pinging 202.103.96.68 with 32 bytes of data: ! |- G& a. O6 U. G
: P9 R+ a% x; J, z* U+ a+ e Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
$ _# Z |0 C1 U ; Z% R7 Z% s0 a( V) D
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
8 v6 v- B4 T' p$ X; V
# t9 ^- E9 ?, d4 S4 t; M Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( g' f. o6 m3 [( E7 G2 b+ ^
, @. o+ ^3 Y a6 ]& K Request timed out. F) c- p: o+ h* l
, m+ e9 C" I3 t5 C6 F: G
………………
2 p ?- ^0 v9 u
" `# L6 Y/ i/ p5 {& O Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
5 F: `0 B w* G E" T$ r + o% N5 e' }' F( q0 ~% g6 P5 E
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
& r) K+ A" O/ T# T. @6 Z9 w, [$ H
" n: A: X+ S, z: i" o Ping statistics for 202.103.96.68:
5 H8 R9 e1 K; ]* U1 _! y. [, Q
4 L( E2 C; k' R% b4 Y' R Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: - b) u |1 f1 M5 w6 J
; S* E R3 S Q3 f
Minimum = 40ms, Maximum = 51ms, Average = 46ms 0 p+ M* a/ e% N: V& O
/ g* m" C5 Z! K& l/ m* v o 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
& a/ g* L5 f$ g
, r; U1 s% x8 O3 R% m -l size Send buffer size. 1 u$ b6 z8 X3 V7 f
0 n; n: j1 _& |* a% K3 h6 p+ n, [+ C( [
定义echo数据包大小。 |
|