dos命令之ping命令大全详解DOS command ping command Daquan detailed.docx
《dos命令之ping命令大全详解DOS command ping command Daquan detailed.docx》由会员分享,可在线阅读,更多相关《dos命令之ping命令大全详解DOS command ping command Daquan detailed.docx(8页珍藏版)》请在冰豆网上搜索。
dos命令之ping命令大全详解DOScommandpingcommandDaquandetailed
dos命令之ping命令大全详解(DOScommandpingcommandDaquandetailed)
PingusageDaquan
Let'sstartwithwhatPingisabout!
WhatisPing?
Pingisatypicalnetworktool.PingisanexecutablecommandthatcomeswiththeWindowsfamily,from98tothelatest2003Serverversionofthecomputer,withthiscommandlinetool.Pingisabletoidentifycertainstatesofnetworkfunctionality.Thestateofthesenetworkfunctionsisthebasisforroutinenetworkfaultdiagnosis.Inparticular,Pingisabletoidentifythebinarystateoftheconnection(thatis,whetheritisconnected).ThePingcommandcheckstheconnectiontotheremotecomputerorlocalcomputerbysendingtheICMPresponsemessagetothecomputerandlisteningforthereturnoftheresponsemessage.Foreachsendingmessage,thePingwaitsatmostonesecondandprintsthenumberofmessagessentandreceived.Compareeachreceivemessageandsendamessagetoverifyitsvalidity.Bydefault,fourresponsemessagesaresent,eachcontaining64bytesofdata.Pingsendsaloopbackrequestpackettothetargethost(address)andrequeststhetargethosttoreceiveareplyafterreceivingtherequest,soastodeterminetheresponsetimeofthenetworkandwhetherthemachineisconnectedwiththetargethost(address).
Pingcommand
Verifytheconnectiontotheremotecomputerorlocalcomputer.ThiscommandisonlyavailablewhentheTCP/IPprotocolisinstalled.(TCP/IPagreementshouldknowtoinstallit,installthesystemwhenthereis,andifincasedeleted,howtodo?
WhatelsecanIdo?
Reinstallit!
!
Howtoinstall,lateron..Haha~~~~)
PingIP[-t][-a][-ncount][-llength][-f][-ittl][-vtos][-rcount][-scount][[-jcomputer-list][-kcomputer-list]][-wtimeout]destination-list|
parameter
-t(checkandspecifytheconnectiontothecomputeruntiltheuserinterrupts.Tointerrupt,presstheshortcutkey:
CTRL+C)
-a(resolvestheaddresstothecomputername)
-ncount(sendsaspecifiednumberofECHOmessagesbycount,defaultto4)
-llengthsendstheECHOmessagecontainingthedatalengthspecifiedbythelength.Thedefaultvalueis64bytesandthemaximumvalueis8192bytes
-f(sendnonsegmentedflag)inthepackage.Thepacketwillnotbesegmentedbythegatewayontheroute
-iTTL(setsthe"livetime"fieldtothevaluespecifiedbyttl.Ofwhich:
TTL:
representsthenumberfrom1to255
-vTOS(setstheservicetypefieldtothevaluespecifiedbyTOS)
-rcountroutingofmessagesandreturnmessagesintherecordroutingfield.ThespecifiedCountvalueisminimum,canbe1,andthemaximummaybe9.)
Cases:
C:
\DocumentsandSettings\Administrator>ping169.254.190.92-r4
Pinging169.254.190.92with32bytesofdata:
Reply,from,169.254.190.92:
bytes=32,time<1ms,TTL=128
Route:
169.254.190.92
Reply,from,169.254.190.92:
bytes=32,time<1ms,TTL=128
Route:
169.254.190.92
Reply,from,169.254.190.92:
bytes=32,time<1ms,TTL=128
Route:
169.254.190.92
Reply,from,169.254.190.92:
bytes=32,time<1ms,TTL=128
Route:
169.254.190.92
Pingstatisticsfor169.254.190.92:
Packets:
Sent=4,Received=4,Lost=0(0%,loss),
Approximate,round,trip,times,in,milli-seconds:
Minimum=0ms,Maximum=0ms,Average=0ms
Descriptionoftheresults(samebelow)
ThePingcommandhastworeturnresults:
1,"Request,timed,out."indicatesthattheresponsepacketreturnedbythetargethosthasnotbeenreceived,thatis,thenetworkisblockedorthenetworkisinbadcondition
2,"ReplyfromX.X.X.X:
bytes=32time<1msTTL=255"receivedfromthetargethostX.X.X.Xreturnsaresponsepacket,thepacketsizeis32Bytes,theresponsetimeislessthan1msTTL255,thisresultsuggeststhatbetweenthecomputertothetargethostyournormalconnection.
3,"Destination,host,unreachable"indicatesthatthetargethostcannotarrive
4,"PING:
transmit,failed,error,code,XXXXX"meansthetransmissionfailed.TheerrorcodeXXXXX
-scount(specifiesthetimestampforthenumberofcallsspecifiedbythecount.ThespecifiedCountvalueisminimum,whichcanbe1,andthemaximumis4.)
Cases:
C:
\文件和设置\管理员>平169.254.190.92S3
砰的169.254.190.92与32个字节的数据:
回复:
从169.254.190.92字节=32次<<1msTTL=128
时间戳:
169.254.190.92:
56724750
回复:
从169.254.190.92字节=32次<<1msTTL=128
时间戳:
169.254.190.92:
56725750
回复:
从169.254.190.92字节=32次<<1msTTL=128
时间戳:
169.254.190.92:
56726750
回复:
从169.254.190.92字节=32次<<1msTTL=128
时间戳:
169.254.190.92:
56727766
统计169.254.190.92平:
包:
发送=4,接收=4,损失=0(0%的损失),
近似的往返时间以毫秒为单位:
最小=0ms时,最大=0ms时,平均0ms
J计算机列表(经过由计算机列表指定的计算机列表的路由报文。
中间网关可能分隔连续的计算机(松散的源路由)。
允许的最大IP地址数目是9。
)
K计算机列表(经过由计算机列表指定的计算机列表的路由报文。
中间网关可能分隔连续的计算机(严格源路由)。
允许的最大IP地址数目是9。
)
w(以毫秒为单位指定超时间隔超时。
)
目的地列表(指定要校验连接的远程计算机)
使用平判断TCP/IP故障
可以使用平实用程序测试计算机名和IP地址。
如果能够成功校验IP地址却不能成功校验计算机名,则说明名称解析存在问题。
1、ping127.0.0.1:
127.0.0.1是本地循环地址,如果本地址无法平通,则表明本地机TCP/IP协议不能正常工作。
2、平本机的IP地址:
用ipconfig查看本机IP,然后平该IP,通则表明网络适配器(网卡或调制解调器)工作正常,不通则是网络适配器出现故障。
3、平同网段计算机的IP:
平一台同网段计算机的IP,不通则表明网络线路出现故障;若网络中还包含有路由器,则应先平路由器在本网段端口的IP,不通则此段线路有问题;通则再平路由器在目标计算机所在网段的端口IP,不通则是路由出现故障;通则再平目的机IP地址。
4、平网址:
若要检测一个带DNS服务的网络,在上一步平通了目标计算机的IP地址后,仍无法连接到该机,则可平该机的网络名,比如平www.sina。
com。
cn,正常情况下会出现该网址所指向的这表明本机的IP,DNS设置正确而且DNS服务器工作正常,反之就可能是其中之一出现了故障;同样也可通过平计算机名检测胜解析的故障(胜是将计算机名解析到IP地址的服务)。
利用平命令判定网络故障
1平本机IP。
例如本机IP地址为:
169.254.190.92。
则执行命令平169.254.190.92如果网卡安装配置没有问题,则应有类似下列显示:
C:
\文件和设置\管理员>平169.254.190.92
砰的169.254.190.92与32个字节的数据:
回复:
从169.254.190.92字节=32次<<1msTTL=128
回复:
从169.254.190.92字节=32次<<1msTTL=128
回复:
从169.254.190.92字节=32次<<1msTTL=128
回复:
从169.254.190.92字节=32次<<1msTTL=128
统计169.254.190.92平:
包:
发送=4,接收=4,损失=0(0%的损失),
近似的往返时间以毫秒为单位:
最小=0ms时,最大=0ms时,平均0ms
如果在MS-DOS方式下执行此命令显示内容为:
请求超时,则表明网卡安装或配置有问题。
将网线断开再次执行此命令,如果显示正常,则说明本机使用的IP地址可能与另一台正在使用的机器IP地址重复了如果仍然不正常,则表明本机网卡安装或配置有问题,
Needtocontinuecheckingnetworkconfiguration.
2.PinggatewayIP
AssumingthatthegatewayIPis:
59.52.177.115,thecommandPing59.52.177.115isexecuted.PerformthiscommandinMS-DOSmode,ifthefollowinginformationisdisplayed:
C:
\DocumentsandSettings\Administrator>ping59.52.177.115
Pinging59.52.177.115with32bytesofdata:
Reply,from,59.52.177.115:
bytes=32,time<1ms,TTL=128
Reply,from,59.52.177.115:
bytes=32,time<1ms,TTL=128
Reply,from,59.52.177.115:
bytes=32,time<1ms,TTL=128
Reply,from,59.52.177.115:
bytes=32,time<1ms,TTL=128
Pingstatisticsfor59.52.177.115:
Packets:
Sent=4,Received=4,Lost=0(0%,loss),
Approximate,round,trip,times,in,milli-seconds:
Minimum=0ms,Maximum=0ms,Average=0ms
3.PingremoteIP
ThiscommanddetectswhetherthemachinecanaccessInternetproperly.Forexample,thelocaltelecomoperator'sIPaddressis:
202.101.224.69.ExecutethecommandinMS-DOSmode:
Ping202.101.224.69,ifthescreenisdisplayed:
C:
\DocumentsandSettings\Administrator>ping202.101.224.69
Pinging202.101.224.69with32bytesofdata:
Reply,from,202.101.224.69:
bytes=32,time=2ms,TTL=250
Reply,from,202.101.224.69:
bytes=32,time=2ms,TTL=250
Reply,from,202.101.224.69:
bytes=32,time=3ms,TTL=250
Reply,from,202.101.224.69:
bytes=32,time=2ms,TTL=250
Pingstatisticsfor202.101.224.69:
Packets:
Sent=4,Received=4,Lost=0(0%,loss),
Approximate,round,trip,times,in,milli-seconds:
Minimum=2ms,Maximum=3MS,Average=2ms
ItshowsthattheoperationisnormalandcanaccesstheInternetproperly.Otherwise,thereisaproblemwiththehostfile(windows/host).
4.checkthelinebetweenyourcomputerandthegateway
Entertheipconfigcommandatthecommandpromptwindow,willreturntoyourcomputeronthenetworkaddressoftheIP(IPAddress),subnetmask(SubnetMask)andgateway(DefaultGateway),andinIPifyouuseyourcomputerisautomaticaccesstoIP,adcressbehindtheshowis169.XXX.XXX.XXXIPaddressyouthecomputerisnotretrievedfromtheDHCPserver.TheIPaddressisavailableforthecomputer.Atthispoint,youcanusethecommandipconfig/renewtoretrievetheIP(win98/meusingipconfig/renew_all),andgenerallygetthecorrectIPaddress,ofcourse,thepremiseisthattheDHCPserverisnormal.Ifyoucan'tgetthecorrectIPaddress,checkthatthefirewallsoftwareblocksthenetworkcardcommunication,suchasthefirewallofWindowsXP.
AfteryougetthecorrectIPaddress,subnetmask,andgatewayaddress,youcanusethePingtooltoprobewhetherornotthelocalcomputerandgatewayareconnected.AfterrunningthecommandPinggatewayaddress,ifthereturnedresultisnormal,andIEstillcannotopenthewebpage,thistimeshouldbefourthsteps.Ifthereturnedresultisnotnormal,thenetworkofyourcomputerandgatewayhostisnotnormal.Atthispoint,iftheAdsluser,youneedtocalltheoperatorstorescue,sothattheychecktheirserverisafault.IfyouareaLANuser,youneedtoaskthenetworkadministratortocheckwhetherthenetworkswitchingdeviceandgatewayserverareworkingproperly.
FromtheworkingprocessofPing,wecanknowthatthehostAreceivedananswerpacketfromthehostB,indicatingthattheaccessandreturnpathsbetweenthetwohostsarenormal.Thatistosay,fromthehostAtothehostB,orfromthehostBtothehostA,itisnormal.So,whatcausedonlyonedirectionPingconnection?
Installapersonalfirewall
InasharedInternetmachine,mostoftheserver'shostshavepersonalfirewallsoftwareforsecurityreasons,andothermachinesthatareusedasclientsaregenerallynotinstalled.Almostallpersonalfirewallsoftware,bydefault,doesnotallowothermachinestoPingnative.ThegeneralpracticeistofilterouttheICMPrequestmessagefromtheoutside,butitdoesnotrestricttheICMPrequestmessagethatisoutofthehomeandtheICMPreplymessagefromtheoutside.Thisway,