|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。
7 k/ y# g7 D. Q$ Q& b3 H
8 y3 e- X+ M5 A, o* F 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: & m! X4 U' R5 Q5 ~/ X' Q+ m5 ]& [
& D; y$ V, D$ A) _$ X9 B- I$ P 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
. \1 H, L6 D5 I, E& f ( U8 E- l7 n7 k9 ?9 D4 S% C' M
Options:
0 n8 X2 ^* r$ H& H- l 4 x- {' Q# o$ \8 s" Y5 k
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
9 y- Z- F$ b& g8 F5 N9 X) o, x ' E8 i' R! X, |$ q
不停的ping地方主机,直到你按下Control-C。 * Y) M: m# N8 W* a
9 g% Y# _8 \# S6 d. O 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 . D) u# m& Q& O3 B" Q$ Q
4 f# z: `$ v w -a Resolve addresses to hostnames. % D5 U% O `9 d: s
* C7 I/ N6 I! p( }3 C6 T9 d
解析计算机NetBios名。
" q0 S) z. ?, X$ h1 m7 s1 m
9 L* E i' U0 q$ k0 y: T* x5 \ 示例:C:\>ping -a 192.168.1.21 0 ]& B+ l0 C' i! q: t
/ Q) D$ O7 B" t* M J: h Q0 b Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 9 e1 l& D1 g$ u$ p# A- ^# K! x
, v! n" j6 N. V3 E: _$ g- W
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
" V9 m/ |3 ~7 h" l0 y
3 g& h, e% s: u/ ?. I2 t+ g; N, R' U Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* o5 Z! l. k$ ? 3 \; z4 A& q* w6 d% l$ y$ j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* h' D j- F( H' x/ [$ y3 B2 u8 Z4 d' A9 P- Z1 N9 I# d
# P U/ |* ^3 D, q! o Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
3 V! K. z% w0 G$ u$ e9 z& o
' B1 L {1 A" U) K8 d3 ^1 m+ U Ping statistics for 192.168.1.21:
, X& S- ]5 V% q 7 r4 l/ @6 ], u0 S s
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: 0 b( r) F. `& f5 ?
! z+ p; y9 ~; p Minimum = 0ms, Maximum = 0ms, Average = 0ms
}( P( A% T/ j# K( |8 A ' F) { Q( u8 [. j
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
2 `5 H) K+ X6 Q& t0 e1 P# s ' |5 H, s/ E2 C. t6 v- s7 p
-n count Number of echo requests to send. ! M, b9 y4 w2 U, b- |- ]) `0 t
' Q1 ?. P! r; Y+ L# o9 n 发送count指定的Echo数据包数。 6 f! j% q6 y" M2 I# I# K
5 l* j1 t" W& R: g* [( \
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
* e3 l: ?& L* t, i* O
0 C7 K& J8 Y- d" w! } C:\>ping -n 50 202.103.96.68
: i% j# d' K) D& {" Z/ S- [: Z
7 T! F7 j8 u9 C1 S6 {* A Pinging 202.103.96.68 with 32 bytes of data:
4 B6 _. s& _$ F( F9 C
" q/ i* C% o+ c% c+ T Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; P& i4 d+ S9 L) L0 K; v
" [. }" }$ o* y0 B. h! |% J% @) \
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 / B3 R0 _2 r0 M9 {# h
# r" u1 ^* ~. g, y2 r Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
( X5 m" ~% E: U$ o4 `5 \ : s* K d0 |$ [3 u: g9 ]8 d& S
Request timed out.
1 V- u; g' s5 W* f& Q% l
2 g9 {; a* W3 k8 A2 b ……………… 9 N6 U$ U* c* K) o8 f
, G+ \! X: i4 Q5 { Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
; N2 }9 s9 X. G* F+ ?7 R
7 J7 I( U# H! A; s Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 - p! L6 O6 [# Q4 Z- A% p7 D, w
5 m: g; c+ J, M* n Ping statistics for 202.103.96.68: ( s7 q" P2 S( A! F1 [# R# S
' J2 W. }% n, X+ i Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds:
1 G+ Y3 g! I0 `$ S2 E + l& _& _9 Y7 W$ U
Minimum = 40ms, Maximum = 51ms, Average = 46ms
5 V. X- }8 r& t) |( O( m+ E
4 }$ e3 v2 ~4 ?+ e; L8 I6 [/ M 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 + d5 w5 E' l# w5 K
1 t1 i! r; ?$ o3 m
-l size Send buffer size.
1 m/ c8 d8 T# V; B& R
7 j. G$ i. c8 ^ 定义echo数据包大小。 |
|