|
  
- UID
- 3
- 帖子
- 66
- 精华
- 1
- 积分
- 2387
- 金币
- 1067
- 威望
- 1015
- 贡献
- 1000
|
教你正确使用Windows的Ping命令
对于Windows下ping命令相信大家已经再熟悉不过了,但是能把ping的功能发挥到最大的人却并不是很多,当然我也并不是说我可以让ping发挥最大的功能,我也只不过经常用ping这个工具,也总结了一些小经验,现在和大家分享一下。 1 O. D" `6 [; e
- `! S8 M, p E' d; m
现在我就参照ping命令的帮助说明来给大家说说我使用ping时会用到的技巧,ping只有在安装了TCP/IP协议以后才可以使用: + N: z, l+ v# l+ a
8 H N# L0 ~+ M
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 ; X: Q, f5 s' _% a# K. A( g8 `
7 l+ p, W1 z* ~/ D) N
Options: ) o# ]- ^/ O+ }* Q; H
4 m& H- [4 ]0 u9 Q: F' c1 L( s
-t Ping the specified host until stopped.To see statistics and continue - type Control-Break;To stop - type Control-C.
. B+ r' j) R/ @8 l5 c. Y + ~' M9 B( T) A& t
不停的ping地方主机,直到你按下Control-C。 & J, G0 |% V' j5 Q" [
" W& X! D% C! o8 o
此功能没有什么特别的技巧,不过可以配合其他参数使用,将在下面提到。
2 [; \7 L& b* R5 p
% ?' y7 `7 s4 y; U2 X( U/ u -a Resolve addresses to hostnames.
^# x, n4 k7 L
; v& R3 R, M0 n1 C; M" ^3 ? 解析计算机NetBios名。 6 N# Y+ R7 u5 s1 @" ?
6 l. n: d1 B) t* R3 J2 I 示例:C:\>ping -a 192.168.1.21
1 `* l! K$ J+ G" `% S+ \ $ O: {, f' k: t
Pinging iceblood.yofor.com [192.168.1.21] with 32 bytes of data:
5 p! t2 l0 n% k6 B9 P( f 3 F$ T, L+ w" K8 `, |6 j
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
* U" m! H# Y. g J
, g* l$ `1 Z4 T2 ?! c1 s' e Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 # c( C5 s7 p( \6 K: D' Q' _
, a, W, U" D; C7 E0 N6 L* ?
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254
1 N7 Q2 o% V0 ]* }$ W/ W: b% h0 ]( r0 J
& P# ~# r8 y# J' P+ @: C$ Z+ ~/ \
Reply from 192.168.1.21: bytes=32 time<10ms TTL=254 0 Q0 u5 O$ g/ ]" V6 ]
+ f: W! f9 A/ w8 `: q
Ping statistics for 192.168.1.21:
2 x# v. r6 H1 j* }+ p4 P) T. _! W4 P. C 5 q& t; V: f1 N& C: r9 C/ n7 x
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:
: |2 V/ o& d8 p
; A' k. L5 ^" [) ~ Minimum = 0ms, Maximum = 0ms, Average = 0ms : `- l$ P9 } o w& a6 R3 {# y
! m: B/ Y6 _% X( f! H 从上面就可以知道IP为192.168.1.21的计算机NetBios名为iceblood.yofor.com。 # m" H& T9 Z& a9 E- Y
9 A3 g6 e [) m) i" p
-n count Number of echo requests to send.
6 K. i Q, O% t l0 ?1 T& D. F( t 4 @! a" M5 m. G2 i; P
发送count指定的Echo数据包数。
0 E& p, ~: M6 t# H/ \( e& ^! {
* T* w* {! a; b0 q% E7 d 在默认情况下,一般都只发送四个数据包,通过这个命令可以自己定义发送的个数,对衡量网络速度很有帮助,比如我想测试发送50个数据包的返回的平均时间为多少,最快时间为多少,最慢时间为多少就可以通过以下获知:
8 s% ? v' q+ ~ # I$ u* t2 N: U0 R
C:\>ping -n 50 202.103.96.68 0 l3 B4 X+ v# z1 c: @% V! O
3 H* G; t0 P) u$ q1 k( J( C2 ] Pinging 202.103.96.68 with 32 bytes of data:
; }8 Z1 M+ ?) _. ?2 Q1 b5 L9 _4 n . b T/ S# I' e
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 " w4 v% H( `. C
% q* Q \/ I" T( V
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241
) V* _, ]2 t: Z5 p- i3 ~$ X % F; S' v( D' c' F! v
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 & m" ?: V R& H% H! u' Y: ] X: F
0 C: n4 |* q. M0 R& {% v Request timed out. 6 V% j. W3 _" |' M B
0 A' ^3 m0 r) S8 d, u; A7 `2 c6 ^
……………… 1 @: V$ N2 F& W/ W* e v
6 j* B) `! w; l1 q: A" A! V Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 2 s: ]3 Z" ?( M/ @" u! L
, s7 g3 e V9 T2 q
Reply from 202.103.96.68: bytes=32 time=50ms TTL=241 G9 c% u4 J s5 q8 ]. U
( h7 E- v p* u- F) Z* ?5 ?
Ping statistics for 202.103.96.68:
0 q. r1 ^6 u4 r8 a2 r' } $ q6 X+ }6 g; ~, n$ e: K# }* P
Packets: Sent = 50, Received = 48, Lost = 2 (4% loss),Approximate round trip times in milli-seconds: - a. j9 _. s: D3 a: Y ^
& @ w S0 P% Y* n/ o Minimum = 40ms, Maximum = 51ms, Average = 46ms % k5 F% G% ^* m# b T8 \
) n& a5 k5 `5 P7 M 从以上我就可以知道在给202.103.96.68发送50个数据包的过程当中,返回了48个,其中有两个由于未知原因丢失,这48个数据包当中返回速度最快为40ms,最慢为51ms,平均速度为46ms。 , j" C! T4 b9 b2 o) u
8 f, G$ x8 q1 s& @" v -l size Send buffer size. - D5 v' l# H1 T: {0 ?3 c
; T! J1 T3 S. I' M: ^' |
定义echo数据包大小。 |
|