标题:
教你正确使用Windows的Ping命令
[打印本页]
作者:
野人e族
时间:
2008-1-27 22:16
标题:
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
. K( W6 k; _, T T" Z7 H: `4 A
9 k; q: N% u6 w: o7 z
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
6 D# k) O1 i5 A$ |" d- q8 {
/ @8 o/ j* \3 X, D2 @
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
, @" o; P: i4 _( _7 s0 D+ Q
% _! ^9 ?3 s$ {: Q% `: D* R
Options:
' W& |0 J( r$ A: ^% ~
0 | Y' a; i( v1 V* Y
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
9 K4 E; T: ?; S- ^3 \& {. \1 m2 y
6 b! S5 m/ K$ |0 Y* j3 v q8 f% g
不停的ping地方主机,直到你按下Control-C。
& y7 A1 d* u+ u7 e# X; a
3 Y( y4 Q, _0 }* v! }
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
7 i0 z: Y+ b- i5 T
7 t6 Z2 n$ Z- c. M# M
-a Resolve addresses to hostnames.
G: N5 G$ U7 F% i6 J7 Y9 O% |" F. q
- ~& h$ k: }+ ~6 ]
解析计算机NetBios名。
6 ^( D$ A/ r9 c2 V, p% g( U
! F( ^( t$ F. D) m
示例:C:\>ping -a 192.168.1.21
; o9 J1 e! ^ d+ I# S& H
5 B0 r- K) J4 [
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
* X! @: _# ^( k' l+ i( q. O. G
; F, q# k% ?; u* _8 l* E6 f
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 ]; @. d. A8 Y$ ?% ?5 Z Q
, H7 u1 s, k% P8 ^5 m0 Y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
2 q! y7 D9 ^" O; B0 K! @
~) g* |! |4 h6 s5 h1 M
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' L7 _% k, t) p# Q$ O
- p5 w, d# _1 R- \# N2 c- ~
: m/ r# O, j- C) i- ^/ l4 N
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
$ G0 |1 U- B- S0 |
, l6 _, \' h$ k# _3 z1 j: z
Ping statistics for 192.168.1.21:
, Y( @" D z: ~* Y8 x; z
4 u6 j2 e i6 j, Y4 i; x, N$ v
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
+ ?* j% v' C7 I1 H1 o8 m
# \$ B/ q. F/ Q5 b* n# |
Minimum = 0ms, Maximum = 0ms, Average = 0ms
& U' W4 W; \. i3 [% x6 f9 n
4 |9 w9 t& J6 e
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
4 c& v4 g2 g7 a+ ], s% u( l
$ G! a6 {% g' G! N" d9 I2 C
-n count Number of echo requests to send.
$ L) A* U) D+ e* {
* R9 o8 C- S1 _& F6 D3 G
发送count指定的Echo数据包数。
0 O3 `6 Q9 e7 @. A2 B) `
2 d7 a7 }8 r! e9 A& H9 q
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
3 V$ G: N& Y% E9 p1 I
/ G4 Q7 d0 @+ ]
C:\>ping -n 50 202.103.96.68
( e/ _8 A- Z' a6 @! ?5 y
& ^ p8 Z' y5 v" P- A
Pinging 202.103.96.68 with 32 bytes of data:
( ~" J8 L9 S( p" ?% {! P1 ]1 I; z4 h
. d# e# \. }! b/ E
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; R) k: n. C: a' N2 N7 V7 f% _
" }9 f* z0 h/ f
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
6 s' t: Y: T' `" q# l& ^9 d
! c9 a3 W3 c3 q$ z
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; A& t" ]( f9 f& Q7 q' u5 s; L2 z6 W
% P! ]4 }6 t+ j
Request timed out.
) P6 c& N4 M9 {* Q
* N1 |$ w& e' o9 L6 i& y
………………
0 L t: X! H/ F: b2 k
, \9 o& Q. P: G6 a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* g: |* ^* \7 O: K. F
& @* b+ U* D4 M; s7 q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
. k0 g% B) \) `. B
; D7 B7 `4 t$ S* E
Ping statistics for 202.103.96.68:
( @4 N7 O. r# i/ v T
" R' A3 B3 u4 W2 G, r
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
! f# i/ ?! j6 N
8 z2 w; j# `3 q+ p2 V+ C+ @
Minimum = 40ms, Maximum = 51ms, Average = 46ms
2 J3 o- q2 k3 _! n8 t! K0 Q
$ `2 Y' T' Z0 C4 _1 H/ N- {
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
5 ]% O. W% G# J* V9 ~7 r7 [
8 X3 _, S7 n0 a5 z$ j# a
-l size Send buffer size.
9 {3 i+ O, I- T3 W! f
1 {9 P4 L" N1 X/ N( d" M
定义echo数据包大小。
作者:
冷雨清心
时间:
2008-9-25 15:54
强大,但是我看得不是很懂!
欢迎光临 捌玖网络工作室 (http://89w.org/)
Powered by Discuz! 7.2