标题:
教你正确使用Windows的Ping命令
[打印本页]
作者:
野人e族
时间:
2008-1-27 22:16
标题:
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
7 q" T2 n* w0 @* q' P9 |, H
s/ [9 k" {& x' e: D) ]+ W/ @
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用:
' e' a# l) X- i0 q5 a
1 V5 V8 P- ~4 ~- _
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
7 U* }* M) y1 }6 v4 C) {2 R L
+ \: i2 [8 I2 A% `
Options:
# X; ~! N% x0 h; K
$ A& s/ L+ f, }$ l: O5 C5 ]. V9 d
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
% }% g3 v4 @. w# g; w
+ S2 ]& Q! G" ?) I5 s- ?5 J
不停的ping地方主机,直到你按下Control-C。
6 i8 m# d( i$ M+ m
" |- g4 r# o9 N
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
* t: m7 u# {0 Z6 n- K& P) z, ]
" S9 z/ ]! n6 S
-a Resolve addresses to hostnames.
! V" g3 |/ K8 U% m
2 {1 y- C# A3 y5 m& ]! h' a# }' m; P
解析计算机NetBios名。
w0 w+ Y( d7 s! J. [
; r( a; D! X9 W) H1 a
示例:C:\>ping -a 192.168.1.21
. Q* H, R k; c
, a' U* \" k$ A6 d8 U
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
* W7 C/ e2 t- V* Z- K0 G: p- K
3 M- V! y2 Z# n }# ^, `
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ H( E& f/ k* v5 _- E
/ B3 }7 r( y. p* U* o( O
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" p- H7 L( }/ w' A
2 X Z8 T" d: G
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
. o* `3 e) [1 ~7 f6 A) P$ e, V( {
. O2 O) @+ T8 w- A
# s6 C, W% A7 k5 C! r
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
( A9 N E+ H/ E( h: S
$ G+ L0 G8 w1 ]4 v& b5 z, Y# P
Ping statistics for 192.168.1.21:
' K, b% M/ c/ i2 E* l+ u
' @4 @1 t G l" O4 J7 ^, d
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
0 b L+ [' ]* u+ O
& s; f% I5 _0 R5 t% r
Minimum = 0ms, Maximum = 0ms, Average = 0ms
7 M0 H/ X7 x3 Q& n% }. i/ B
! D0 |. i8 _# f2 a
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
& [( ~+ r$ D+ Y4 W# O6 D
- q- i' \8 D, d4 ?
-n count Number of echo requests to send.
: G' j% q% c, K" G
1 l2 |. z! K! }5 N2 V0 M1 t
发送count指定的Echo数据包数。
4 i! | L5 Q" j! _; a
6 E) W/ k% u; O8 s' z
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
$ ]8 z# `6 }: P
1 o. ~/ y0 U; M2 y
C:\>ping -n 50 202.103.96.68
5 Q3 d: F/ a% W9 z% L
% y' `. k9 ~7 G; q# C' \; H L! ` n
Pinging 202.103.96.68 with 32 bytes of data:
0 u( L8 ?0 }- j" x7 F
" l G3 j1 ?: ^ w/ I
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
0 P& o. Y7 q1 h0 ?3 D
3 T* K/ i% d5 H5 {& X
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: n( P2 e1 o+ h8 W) k
. v0 c0 |: K& c7 W) `+ u9 a
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
* m; g( f- B3 ]& j% p
5 ?6 F: O- o& E( G
Request timed out.
- }* U \1 f4 ~3 Z: T
, u/ ^/ Q. n4 ^& p$ P" G1 D+ t
………………
8 B( L( R1 H# Y. ~: P' x3 h
. a7 Q5 L8 x0 c$ Z! Q3 a( N1 T
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
3 v) d2 X8 k3 m8 b. C+ ^* [% w% y
' K; @) g5 }; a4 ^, c- K) _8 V$ }
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: u. K5 s m& t4 y( z( q
l) C& }& ^& V* V7 O0 i
Ping statistics for 202.103.96.68:
4 `7 {& _& l9 Y
0 T# @8 ?& T. p, V1 m7 P" Q
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
, f$ \" P- @7 f# I# y2 m
% [; f; R& Z4 n4 v" c' i ~# h2 W
Minimum = 40ms, Maximum = 51ms, Average = 46ms
; j& M& y- N7 E6 s! s3 h
- _' ^: x) j* C* u9 a* I' p; H
从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
1 {( D' c8 Q* N$ ]
; m: d* ~/ p. A% |, D0 P3 n
-l size Send buffer size.
( G. }2 {7 J. O# E7 l
/ |! I! c; ?) A- ^. _% O
定义echo数据包大小。
作者:
冷雨清心
时间:
2008-9-25 15:54
强大,但是我看得不是很懂!
欢迎光临 捌玖网络工作室 (http://89w.org/)
Powered by Discuz! 7.2