Tải bản đầy đủ - 0 (trang)
Chapter 27. Troubleshooting Tools for TCP/IP Networks

Chapter 27. Troubleshooting Tools for TCP/IP Networks

Tải bản đầy đủ - 0trang

CheckingtheHostSystem'sConfigurationFirst

Beforeyoustarttocheckthecables,networkadapters,hubs,

andotherphysicalcomponentsofthenetwork,youshould

checktoseewhetherthereisaproblemwithacomputer's

TCP/IPconfiguration.Youcandothisbyusingthetools

providedwiththeoperatingsystem.Informationabout

WindowsconfigurationscanbefoundinChapter24.Linuxor

Unixusersshouldchecktheirspecificdocumentationandman

(manual)pagesforinformationonhowtoconfigurenetworking

onasystem.Thisconfigurationinformationcanusuallybe

enteredduringtheinstallationoftheoperatingsystem,butyou

mayfinditnecessarytochangeit.Forexample,ifyoumove

thecomputertoadifferentsubnetyouwillhavetomake

changes.ChecktobesurethatthesystemhasanIPaddress

thatusesthesamenetworknumberastheothercomputerson

thelocalsubnet.Alsochecktobesurethatthecorrectsubnet

maskanddefaultgatewayareused.IfyouareusingDHCPto

assignconfigurationinformation,checktoseethatthereisa

DHCPserveronthesubnetoraDHCPrelayagentoperatingon

thesubnet.Ifeverythingchecksoutokay,itistimetostart

usingthebasictroubleshootingtoolsthatareavailablewith

mostversionsofTCP/IP.

TheDynamicHostConfigurationProtocol(DHCP)iscoveredin

Chapter28,"BOOTPandDynamicHostConfigurationProtocol

(DHCP)."



UsinghostnameandRelatedCommands

Thehostnamecommandisperhapsthesimplestcommandyou



canusetobegincheckingtheconfigurationofahostcomputer.

OnWindowssystems,thiscommandprintsthenameofthe

hostcomputeronwhichitisexecuted.Justenterthecommand

intheCommandPromptwindow.

Whywouldyouwanttousethehostnamecommand?Becausethe

hostnameistranslatedintoanIPaddress,youcanusethe

system'shostnametoensurethatthecorrectIPaddressis

associatedwiththatname.IfaDomainNameSystem(DNS)

servershowsadifferentIPaddress,youwillknowthatyou

cannotreachthisparticularhostbyusingitshostname.Ifthis

isthecase,checktoseewhethertheIPaddressisinuseby

anothersystem.Ifnot,youcanchangetheDNSrecordsothat

thehostnameandIPaddressarerelated.Othermethodscan

alsobeusedtotranslatehostnamestoIPaddresses.See

Chapter29,"NetworkNameResolution,"formoreinformation

aboutthistopic.

ThehostnamecommandcanbeusedonUnixandLinux.

Dependingontheoperatingsystem,andhowyournetworkis

configured,andthecommand-lineparametersused,youmay

getjustthenameassignedtoyourcomputer,orthefully

qualifiedDNSname,aswellasotherUnix/Linux-specific

information.Youwillfindseveralotherrelatedcommands

discussedherethatcanbeusedtoreturninformationaboutthe

nameofthesystem,aswellasnetworkinformation.Whereas

thiscommandonWindowsNT/2000/XPsystemsoutputsthe

nameofthehosttothecommandline,theLinuxversionoffers

youmanyoptionsforviewingthehostnameforthesystem.

Followingisthesyntaxforusinghostname(andafewvariants

thatreturnsimilarinformation)forLinuxVersion8.0:



hostname[-v][-a][--alias][-d][--domain][-f][--fqdn

[-i][--ip-address][--long][-s][--short][-y][--y

[--nis][-n][--node]

hostname[-v][-Ffilename][--filefilename][hostname

domainname[-v][-Ffilename][--filefilename][name]

nodename[-v][-Ffilename][-filefilename][name]



dnsdomainname[?-v]

nisdomainname[?-v]

ypdomainname[?-v]



[-a][--alias]Displaysthealiasnameofthehostifoneis



beingused.ThealiasnameshouldbefoundinyourDomain

NameSystem(DNS)serverdatabase.

[-d][--domain]DisplaysthenameoftheDNSdomain.

[-F][--filefilename]Readsthehostnamefromthespecified



filefilename.Notethatthehostnamefileisnowconsidereda

relicofthepast,butitstillservesausefulpurposeforsome

specificsituations,asdiscussedinChapter30.

[-f][--fqdn][--long]DisplaystheFQDN(fullyqualified



domainname).AFQDNconsistsofashorthostnameand

theDNSdomainnamefoundinthe/etc/hostsfile.

[-h][--help]Printsausagemessageandexits.Thisisall



youhavetorememberifyoudon'tcarrythisbookaround

withyou!

[-I][--ip-address]DisplaystheIPaddress(es)ofthehost.

[-s][--short]Displaystheshorthostname.Thatis,instead



oftheFQDN,onlythefirstpartofthehostname(beforethe

firstperiodcharacter)isdisplayed.

[-V][--version]Printsversioninformationonstandard



outputandexits.



[-v][--verbose]Causesthecommandtoproduceadditional



output.

[-y][--yp][--nis]DisplaystheNIS(ortheolderYP)domain



name.Ifaparameterisgiven(or--filename),thenrootalso

cansetanewNISdomain.

Asyoucansee,theLinuxcommandisalittlemorecomplex

thantheWindowsversion.Thefollowingrelatedcommandscan

alsobeused:domainname,nisdomainname,andypdomainname.Eachwill

giveyouthehostnamethatisstoredintheNIS(Network

InformationSystem)database.



Note

NISstandsforNetworkInformationSystem.

FormerlyknownasYellowPages(YP),thenamewas

changedduetoatrademarkdispute.Formore

informationonmanaginguserswithYPandNIS,see

Chapter38,"ManagingUnixandLinuxUsers."



UsingipconfigandifconfigtoCheckHost

Configurations

TheipconfigcommandisusefulforcheckingtheTCP/IP

configurationofWindowsworkstationsorservers.Asimilar

commandonUnixandLinuxworkstationsisifconfig.On

Windows95/98orWindowsMesystems,youcanusethe

winipcfgcommand.



ipconfigforWindows

Simplyentertheipconfigcommandatthecommandprompt.

Usingtheipconfigcommandwithnoparametersdisplays

networkconfigurationinformationabouteachadapteronthe

system,aswellasforPPP(dialuporVPN)connections.The

basicinformationincludesthefollowing:

IPaddress

Subnetmask

Defaultgateway

DNSserverinformation

Windowsdomain

Here'sanexampleoftheoutputthatipconfiggenerates:

C:\DocumentsandSettings\Mark>ipconfig

WindowsIPConfiguration

EthernetadapterLocalAreaConnection3:

Connection-specificDNSSuffix.:

IPAddress............:192.16.0.100

SubnetMask...........:255.255.255.0

DefaultGateway.........:192.16.0.1



Iftheadapterisnotconnectedtoanetworkcable,youwillsee

thefollowinginformationinsteadofDNSandothernetwork

information:



MediaState...........:Mediadisconnected



IftheadapterlistsanIPaddressof0.0.0.0,itdoesnothavea

validIPaddress.IfthenetworkadapterreceivesanIPaddress

fromaDHCPserver,makesurethenetworkcableisproperly

connectedtotheadapter,andthenusetheipconfig/releaseand

ipconfig/renewcommandsinsuccessiontoobtainanewaddress.

Ifthenetworkadapterusesafixed(user-assigned)IPaddress,

openthenetworkadapter'spropertiessheet(inNetwork

ConnectionsorNetworkNeighborhood)andmanuallyconfigure

thenetworkadapter'sIPaddressandotherTCP/IP

configurationinformation.

Eachnetworkadapterinasystem(includingwirelessadapters)

hasaseparatesectionlistedintheoutputforipconfig.

Withthe/allparameter,youalsocanobtainthehardware

(MAC)addressandDHCPinformationforeachnetworkadapter

inacomputer.Youalsocanusethiscommandtorenewor

releaseDHCPconfigurationinformationtoattemptto

reconfigurethecomputerwithupdatedinformation.

Here'sanexample:



C:\DocumentsandSettings\Mark>ipconfig/all

WindowsIPConfiguration

HostName............:tiger-athlon

PrimaryDnsSuffix.......:

NodeType............:Mixed

IPRoutingEnabled........:No

WINSProxyEnabled........:No

EthernetadapterLocalAreaConnection3:

Connection-specificDNSSuffix.:

Description...........:LinksysLNE100TX(v5

PhysicalAddress.........:00-20-78-0D-D5-BF

DhcpEnabled...........:Yes



AutoconfigurationEnabled....:Yes

IPAddress............:192.16.0.100

SubnetMask...........:255.255.255.0

DefaultGateway.........:192.16.0.1

DHCPServer...........:192.16.0.1

DNSServers...........:63.64.9.11

63.64.9.19

LeaseObtained..........:Monday,September2

LeaseExpires..........:Tuesday,September



ThesyntaxforWindowsis

ipconfig[/?|/all|/release[adapter]|/renew[adapter

|/flushdns|displaydns|/registerdns

|/showclassidadapter

|/setclassidadapter[classidtoset]]



/allCausesaverbosedisplayofalltheconfiguration



informationthattheipconfigutilityhasaccessto,including

multipleadapters.

/release[adapter]ReleasesanIPaddressthatwasconfigured



usingDHCP.Ifyouusejustthe/releasequalifierbyitself,

thesystemwillattempttoreleaseIPconfigurationforall

adaptersonthecomputer.Otherwise,youcanusethe

syntaxof/releasenametoreleasetheIPconfigurationfora

specificadapterwiththespecifiedname.Notethatyoucan

usewildcards,suchas/release"wireless*"toreleaseall

wirelessaddresses.



Note



Youcanseetheadapternameswiththe

unqualifiedipconfigcommand.Forexample,ifan

adapterislistedas"EthernetadapterLocalArea

Connection,"youcoulduseipconfig/release

"Local*".NotethatunderWindows2000and

newer,youcanalsoviewtheadapternamesby

right-clickingNetworkNeighborhoodand

selectingPropertiesfromthepop-upmenu.The

adapternamesarethenamesoftheicons.If

youusetheDetailsview,thenameis

convenientlylistedundertheNamecolumn.



/renew[adapter]RenewsanIPaddressthatwasconfigured



usingDHCP.Ifyouusejustthe/renewqualifierbyitself,the

systemwillattempttorenewIPconfigurationforall

adaptersonthecomputer.Otherwise,youcanusethe

syntaxof/renewnametorenewtheIPconfigurationforan

adapterwiththespecifiedname.Aswith/release,youcan

usewildcards,suchas/renew"wireless*"torenewallwireless

addresses.

/flushdnsPurgestheDNSresolvercache.

/registerdnsRefreshesallleasesgrantedbyDHCPforthe



adapterandreregistersDNSnames.

/displaydnsShowsthecontentsoftheDNSresolvercache.

/showclassid[adapter]DisplaysalltheDHCPclassIDsallowed



foradapter.

/setclassid[adapter][classidtoset]ModifiestheDHCPclassID.



DHCPclassIDsarecoveredinmoredetailinChapter28.



Tip

WhenaWindowssystemobtainsatranslation

(hostnametoIPaddress)fromaDNSserver,it

storestherecordinacacheforashortperiod.When

thenameisusedagain,theTCP/IPstackwillfirst

consultthecachetoseewhethertherecordexists,

thusprovidingaquickerresponsethanifaDNS

serverisqueried.Tokeepthecachesettoa

reasonablesize,eachrecordisflushedfromthe

cacheafteraTimetoLive(TTL)valuefortherecord

expires.IfyouhavemadeachangetoaDNS

record,youcanusetheipconfig/flushdnscommand

toremoveallrecordsfromthecachesothatthe

DNSserverwillagainbeconsulted,andthecache

willbegintostorenewrecords.Theipconfig

/displaydnscommandwillshowyouthecontentsof

thecache,whichcanbehelpfulwhenyouarenot

surewhetherthecacheorDNSserverisbeing

consultedforthenametranslation.



Obviously,thiscommandisextremelyusefulwhenyouare

tryingtosolveproblemsrelatedtoDNSandDHCPfunctions.

Forexample,youcanuse/releaseand/renewtoseewhetheryou

arehavingproblemsobtainingconfigurationinformationfroma

DHCPserver.IfyouareunabletorenewtheIPaddresswiththe

/renewswitch,there'saproblemwithyourconnectiontothe

DHCPserverandyoushouldcheckthefunctionalityofthe

networkadapter,cable,andanyintermediarynetworkdevices

uptoandincludingtheDHCPserver.



YoucanusetheDNSqualifierswhenyou'vemadeconfiguration

changesandwanttokeepthelocalcacheupdatedorregister

thenewconfigurationinformationwithaDNSserver.The/all

qualifiershowsalltheoutputtowhichthecommandhasaccess

andisfrequentlyusedtoscanforproblems.Toseeallthe

outputwithouthavingitscrolloffthescreen,usethecommand

intheformofipconfig/all|more.Youcanalsousethe

commandipconfig/all>filenametosendtheinformationtoafile

sothatyoucanprintit,orsavetheinformationforuseinthe

future.

Thequantityofinformationyoucanshowisusefulwhen

constructingaspreadsheetorotherdocumentforhelp-desk

use.Onemethodthatwillhelpyoukeepupwithcurrent

configurationinformationisplacingthefollowingcommandina

loginscriptorstartupfile:

ipconfig/all>networkdrive%computername%.config



The%computername%environmentvariableisreplacedwiththe

computernamethatisassignedtothesystemandatextfileis

created.Byplacingtheoutputfileonanetworkdrive,youcan

haveitavailableforusebyadministrativeorhelp-deskstaff.

Theserverthatprovidesthefilesharenetworkdrivecanusea

scriptfileappropriateforthatoperatingsystemtoparsethe

informationandstoreitinadatabase.



Tip

Acommonmethodforimportinginformationintoa

spreadsheetistocreateacomma-delimitedfile.If

youuseWindows,Unix,Linux,orsomeother

operatingsystem,itiseasytotaketheinformation

providedbytheipconfigcommandandparseit,and

separatetheimportantinformationbyinserting



commas.Yourscriptfilecanthenbeusedtoload

theinformationintoaspreadsheetonaperiodic

basis.



ifconfigforUnixandLinux

OnUnixandLinuxsystems,ifconfigisaverypowerful

command.YoucanuseittodisplayIPconfiguration

information,andalsotomakechangestotheconfiguration.

Thiscommandisusedinstartupfilestoenablenetwork

adaptersorprovideaddressinginformation,amongotheritems.

Onlineyoucanusethiscommandtomakechangestothe

configuration.

SomeversionsofUnixallowyoutousethiscommandtoview

statisticsorconfigurationinformationforeachnetworkadapter.

Otherssimplyprintashortlistofthesame,andaremainly

usedtoconfiguretheadapters.Todeterminetheoptions

availableinyourversionofUnixorLinux,entermanifconfigata

UnixorLinuxshellprompttoviewtheman(manual)pagefor

theifconfigcommand.

Althoughtheifconfigcommandisusedduringtheboot

sequencetoperformtheinitialconfigurationfornetwork

adapters,afterthesystemisupandrunningonlytheroot

accountcanusethiscommandtochangetheconfiguration.For

troubleshooting,itisaquickwaytogettheinformationyou

needinordertodeterminewhetherthesystemwasproperly

configured.ForthoseunfamiliarwithUnix,thesuperuserisjust

anothertermfortheuseraccountthathasfullsystem

privilegesandcanperformalltasks.ForUnix/Linuxthisaccount

isnamedroot.



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 27. Troubleshooting Tools for TCP/IP Networks

Tải bản đầy đủ ngay(0 tr)

×