|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 ' p) O& q# Q4 }: h% A: o/ G9 h
5 B5 o5 l" n# g1 g$ ^# g W$ O 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: A1 W, V2 Q' K R+ ^2 Y
5 B5 Z; Y; l6 B0 n
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 2 ^" i/ g% m6 I; D
) `8 X a, O6 c% E
Options: ) ?% A# C% Y! ^5 T$ D$ l$ y
/ ]& H5 H- j H6 m8 A/ R
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C. , u2 c8 @4 D: s5 e
& S3 m: `9 N7 Y- k0 P 不停的ping地方主机,直到你按下Control-C。 2 Q( ], O- I$ J- D0 T7 Q2 P
9 z0 ?: K) ^ H1 l, D 此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。 ! ~9 V: R$ ` E3 H
! b+ G+ X& b' y1 }2 F8 I
-a Resolve addresses to hostnames.
; u' R# ~- S+ S4 y7 z
* @6 G4 h+ q) f* f 解析计算机NetBios名。
/ q0 {3 s& C( w D p: s
3 ?9 v/ X ^0 q& a2 R' g9 x: h5 n 示例:C:\>ping -a 192.168.1.21 j4 j) i0 p: ]# S& s
" l# a1 ^- k! C6 `5 h" o% _ Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: - U$ ^! g" N& d( ^
; `8 R- P, e- x: T Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 @: H# b% A* D) I
4 x0 k: H8 _+ @# F4 P: _! t( ^
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
7 z- _3 Q% ^, l" L6 K/ T 3 B' B# H) s& y0 [
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
/ ~/ i7 Z& _0 R! a$ n: T: |; B- S9 t
7 E' M( K! `- ~% s* B3 M* R$ {
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
, `3 |' z5 x- A
0 ~& n: x# Z# \ X$ \/ s4 ?5 @ Ping statistics for 192.168.1.21: ' V9 G8 A5 D! z" W' h
$ T+ E% `7 h$ Z& y! k
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
4 V9 P* a4 y7 ]' ?& {+ R 2 b1 G. m$ e* S+ M" d' L
Minimum = 0ms, Maximum = 0ms, Average = 0ms
/ D; B6 }$ m* @% U- b+ J! I/ C
* V: E+ C8 `7 { 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
2 d4 X" p9 {; ]/ v0 y7 C
. _0 H/ T! f; G9 L -n count Number of echo requests to send. 4 V. |0 P+ u; M, P: @0 A- s w$ E
: ^0 J* `+ ^$ G# U9 |. R9 S. c3 |
发送count指定的Echo数据包数。
6 y7 o- I# B, L- _ ' T) R( ?; c- y# r+ b
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
( Y! n! q6 F' N0 ~
. n: J! w( T/ b7 l C:\>ping -n 50 202.103.96.68
% ?$ p# T4 j5 h1 m % v; q2 S$ |" L6 a* J# E: f
Pinging 202.103.96.68 with 32 bytes of data: ( u% L+ y7 ?% C- q3 Z. t
: @( h0 D, \ C0 x8 n Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 . D; |! o0 v* Y6 m, h
# Y5 F Y3 B0 C. s
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
2 T2 V- T. W4 H$ X6 ~& n
7 o; a, o) m/ E6 t Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 9 P y' U. f3 y4 Q( O
2 t; g$ ]5 L* v Request timed out. " M8 o8 ?; z& A5 O& x
8 X) q' {5 X. T7 H/ ^1 V! Y5 j" ~ ……………… 1 F4 V) L& N. L& m1 v, h; U$ [
: x2 H( E2 [: f: w. g6 ?1 t E5 l Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
- @4 \$ m+ _# C. J ( {/ a. D! S& v4 t1 C. E1 e5 j
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
/ Q2 x0 n+ W, M7 i$ D8 L5 ?( [ 7 K. @; ]" v8 \: D
Ping statistics for 202.103.96.68:
) |% l* Z; S2 F }
* r# P/ Z: f6 B# X U4 D4 c Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: , d% K- F: U$ @1 T8 p- p
0 N2 j, b- B8 r- o5 j Minimum = 40ms, Maximum = 51ms, Average = 46ms
8 y, h! ~3 a# E, S" D% H) l
3 U/ @: r7 |5 x# b9 R 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
/ q/ ]1 i9 C$ K+ P
5 f6 T8 _" D2 }" F: [' U; f -l size Send buffer size. ( M% U. m/ K! y3 T5 `1 y z
+ B$ x3 b; W. g% }$ e: ], X
定义echo数据包大小。 |
|