|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 3 A+ S/ ^$ Y+ d7 H* | I- D
" j4 g6 k r+ U2 F- I* z6 [3 a1 a- j 现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: , w) E+ y: y$ x$ _4 |5 h" g7 ^8 E
% u# |, R1 T9 r- 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
, D& T0 C( R& y) Y& ]( `4 J
: M' B: ~7 H' d! P; @& m Options:
7 p `3 `9 @; S) M( E : z4 K( U3 x2 }& q* l* J4 n
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
: T6 t% n% \5 F9 Z
9 @' Q2 Z& A5 E/ A 不停的ping地方主机,直到你按下Control-C。 & n- @5 Y$ a1 B7 b# n8 p" D
8 Q4 o/ N- s, o
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
) T6 f: P$ n+ E0 t9 B ; T0 O a4 S" }* ~! ^
-a Resolve addresses to hostnames. ) S8 d- W, y$ b# c
% B3 z/ s5 ?! f5 v" [* X, _
解析计算机NetBios名。
# Q, \4 d/ h9 X; ^ ' z, _7 e$ {1 e! ?: e
示例:C:\>ping -a 192.168.1.21
* V& s1 [$ a U; ` . ^4 ]4 w& c- A/ q/ ?8 Y2 q
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data: 2 T1 m7 ]4 O# r% m+ R( O
% k0 |- e- s# a Z8 d# J U' S Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
9 {6 D1 \7 N* G: _% i! d3 G
& B* B) [8 R# l' } Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
4 F9 Y. b3 R) ?' Y/ m) H( x
- R5 I1 L" h1 V9 r4 u Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 * d! O) S. Q. Z% Y
/ x" {* T* B6 P; J3 Y
& Z( P8 I# D' c$ B( j2 g N# U y
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
' [& x V2 K& r! n3 e3 |* b, a+ e8 e; ~
* n: e3 q! O2 l Ping statistics for 192.168.1.21: : G' w. Y$ a; Y, H3 N) r( x
6 |% B" x4 k/ R, j* |5 I( d) a Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
8 w7 m" \+ e+ ^9 G$ {! ]
& E+ }; W0 N, e/ d H8 Y Minimum = 0ms, Maximum = 0ms, Average = 0ms $ f l' i, }+ p: u
9 V( ], O0 F: {$ s& H
从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。
0 k# J5 l/ Q8 c1 K% D* {$ l- g- h 8 ^, U" p2 {- K& D- s
-n count Number of echo requests to send.
# n5 t/ f) n/ A( p& | $ S; |% Z! h+ l ?1 v1 x
发送count指定的Echo数据包数。 4 \! p8 K3 `; D
% u3 Q: E6 B! ]! d
在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
+ A5 ^9 G# Y' l
2 q9 M z) {2 {. W: c9 i4 B! \0 U C:\>ping -n 50 202.103.96.68
" A9 e' ~2 {2 j3 x) [" c ( a# Y4 F( \& \& }0 ] [
Pinging 202.103.96.68 with 32 bytes of data:
v4 J0 y3 R$ R2 o
1 M9 f. S7 Z8 P! i$ b: j9 i8 v7 T. I Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
, w6 D8 F3 B# n( y/ w6 y
2 U7 {* V6 s5 i+ z. Q2 T& @( D Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
: M0 K3 k. Y& d/ x9 C3 w" h ! b* l. x0 q$ R2 P2 \$ Q3 V( B7 t `
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
# [( P. o+ B( H7 N + D* L$ d K1 P4 x3 o$ M( T
Request timed out.
& Q, r7 F7 s) e& c 2 @$ R& {1 x& K5 c1 \
………………
/ q5 ?% `. H7 e
, @5 L) m8 Q" ^* N Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 ; r( g% Y) ~$ |+ w- v4 E5 `( W
I# s6 I5 c7 c6 {- t i# K! K1 M
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 3 ?' s" X0 \1 t$ K% K
g6 |8 f" U! J Ping statistics for 202.103.96.68: 0 C/ M1 r9 c- a& y1 B
5 ~2 N4 U7 S$ x" u2 E8 P7 b
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: / z; f8 k$ u3 z1 j& y
e6 P. W" U. |/ @0 b
Minimum = 40ms, Maximum = 51ms, Average = 46ms / ~0 C: |2 X7 x& B& N( c4 |
0 Y' l' P+ b% |& l4 i 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。
/ S2 c+ G( ?( v ' ~2 L" c) W* o$ @
-l size Send buffer size. 3 p. `. s' N: B, x$ Y
- Y" u5 j3 b" J) W6 S, x
定义echo数据包大小。 |
|