Vous êtes sur la page 1sur 9

31/3/2017 Procedure

Clickheretoprintthispage

Discovery1:GetStartedwithCiscoCLI
Task1:NavigateBetweenEXECModes
ThissessionwillguideyouthroughthenavigationbetweenuserEXECandprivilegedEXEContheCiscoIOScommandline.Thelabispreparedwiththedevices
thatarerepresentedinthetopology,butforthissessionyouwillonlybeusingSW2.

Activity
Step1:AccesstheconsoleofSW2.
Thegreaterthansymbol(>)attheendofthepromptisanindicationthatyouareaccessingtheuserEXEC.

SW2>

Step2:Usethequestionmark(?)toviewthelistofcommandsthatareavailableinuserEXEC.
WhenthedisplayoutputpauseswiththeMoreprompt,youcanusethespacebartodisplaythenextpageoftheoutput.

SW2>?
Execcommands:
accessenableCreateatemporaryAccessListentry
accessprofileApplyuserprofiletointerface
clearResetfunctions
connectOpenaterminalconnection
cryptoEncryptionrelatedcommands.
disableTurnoffprivilegedcommands
<...outputomitted...>
mtraceTracereversemulticastpathfromdestinationtosource
nameconnectionNameanexistingnetworkconnection
More
padOpenaX.29PADconnection
pingSendechomessages
<...outputomitted...>
whereListactiveconnections
x3SetX.3parametersonPAD
YouhavetopressthespacebartwicetoscrollthroughthecompletecommandlistundertheuserEXEC.Havethisinformationinmind,becauseyouwillsoon
contrastittowhatyouwillbeabletoseeintheprivilegedEXECmode.
Thecommandsarelistedinalphabeticalorder.NotethattheconfigurecommandisnotavailableunderuserEXEC.
Intheoutputs,likeinthepreviousone,manylinesareomitted,duetospacepreservation.Omittedlinesareindicatedwith<...outputomitted...>string.
Step3:Asyoujustsaw,whenyouarepresentedwiththeMoreprompt,youcanusethespacebartoscrollthroughtheoutput
pagebypage.
YoucanalsousetheEnterkeytoscrollforwardjustoneline.Youcanalsocanceltheremainingoutput.Themethodtocanceltheremainingoutputisdevice
andoperatingsystemversiondependent.SometimesyouneedtopressCtrlCandsometimesyouneedtopress"Q."OnSW2,youcanpressanykeyotherthan
thespacebarortheEnterkey.Giveitatry!

SW2>?
Execcommands:
accessenableCreateatemporaryAccessListentry
accessprofileApplyuserprofiletointerface
clearResetfunctions
connectOpenaterminalconnection
cryptoEncryptionrelatedcommands.
disableTurnoffprivilegedcommands
<...outputomitted...>
mtraceTracereversemulticastpathfromdestinationtosource
nameconnectionNameanexistingnetworkconnection
More
padOpenaX.29PADconnection
More
pingSendechomessages
More
SW2>

EnteringEXECMode

Asasecurityfeature,CiscoIOSSoftwareseparatesEXECsessionsintothefollowingtwoaccesslevels:

UserEXEC:Allowsyoutoaccessonlyalimitednumberofbasicmonitoringcommands.WheninEXECmode,thepromptendswiththegreaterthanorright
anglebracket(>)symbol.Forexample,whenyouareinEXECmodeonadevicewiththehostnameDTW_Switch,thepromptwouldbeDTW_Switch>.
PrivilegedEXEC:Allowsyoutoaccessalldevicecommands,suchasthosethatyouwoulduseforconfigurationandmanagement.Itcanbepasswordprotected
toallowonlyauthorizeduserstoaccessthedevice.Wheninthismode,thepromptendswiththeoctothorpeorpound(#)symbol.Forexample,whenyouarein
privilegedEXECmodeonadevicewiththehostnameDTW_Switch,thepromptwouldlooklikeDTW_Switch#.TochangefromuserEXECmodetoprivileged
EXECmode,entertheenablecommandatthehostname>prompt.ToreturntotheuserEXEClevel,enterthedisablecommandatthehostname#prompt.

Bydefault,noauthenticationisrequiredtoaccessuserEXECmodefromtheconsole.YoucanentertheEXECmodebysimplypressingtheEnterkey.However,if
loginisconfigured,youmustenterausernameandpasswordtoentertheEXECmode.Itisagoodpracticetoensurethatauthenticationisconfiguredduringthe
initialconfiguration.
Enteringthequestionmark(?)inprivilegedEXECmoderevealsmanymorecommandoptionsthanenteringthecommandattheuserEXEClevel.Thisfeatureis
referredtoascontextsensitivehelp.
UserEXECModeSummary

UserEXECmodeprovidesalimitedexaminationofaswitchorrouter.
Offeringonlyalimitednumberofbasicmonitoringcommands,userEXECmodeissometimesreferredtoasviewonlymode.
Thismodedoesnotallowreloadingofthedeviceorswitch.
Givenitslimitedcapabilities,thismodeisusefulforsomebasicoperations.

PrivilegedEXECModeSummary

PrivilegedEXECmodeprovidesadetailedexaminationofaswitchorarouterandenablesconfigurationanddebugging.
PrivilegedEXECmodeprovidescriticalcommands,suchasthoserelatedtoconfigurationandmanagement.
TochangefromuserEXECmodetoprivilegedEXECmode,entertheenablecommandatthehostname>prompt.
Ifanenablepasswordoranenablesecretpasswordisconfigured,theswitchordevicepromptsforthispassword.
Whenthecorrectenablepasswordisentered,theswitchordevicepromptchangestohostname#.
ToreturntotheuserEXEClevel,enterthedisablecommandatthehostname#prompt.

Step4:UsetheenablecommandtoaccesstheprivilegedEXEC.
Thelastcharacterintheprompthaschangedtotheoctothorpe(#)symbol.ThissymbolindicatestoyouthatyouareinprivilegedEXEC.

SW2>enable
SW2#

Step5:Usethe?commandagaintodisplaythecommandsthatyoucanuseunderprivilegedEXEC.Usethespacebartoscroll
throughtheentirelistoftheoutput.

SW2#?
Execcommands:
accessenableCreateatemporaryAccessListentry
accessprofileApplyuserprofiletointerface

https://cll1.cisco.com/content/xtrac/2 1/9
31/3/2017 Procedure
accessprofileApplyuserprofiletointerface
accesstemplateCreateatemporaryAccessListentry
archivemanagearchivefiles
beepBlocksExtensibleExchangeProtocolcommands
calendarManagethehardwarecalendar
cdChangecurrentdirectory
clearResetfunctions
clockManagethesystemclock
cnsCNSagents
configureEnterconfigurationmode
connectOpenaterminalconnection
<...outputomitted...>
enableTurnonprivilegedcommands
eouEAPoUDP
More
eraseEraseafilesystem
<...outputomitted...>
UnderprivilegedEXEC,youneededtopressthespacebarfourtimestogetthroughtheentirelistofcommands.UnderuserEXEC,youonlyneededtohitthe
spacebartwice.
UnderprivilegedEXEC,youcanusetheconfigurationcommand.YoucannotproceedtotheconfigurationmodefromtheuserEXECyoumusttraverse
throughtheprivilegedEXECfirst.
Step6:UsethedisablecommandtoreturntouserEXEC.

SW2#disable
SW2>
Thelastcharacterinthesystemprompthasreturnedtothegreaterthansign(>).

Task2:ExploreCLIHelp
Thissessionwillguideyouthroughusingthequestionmark(?)commandforhelpontheIOSCLI.Itwillalsodemonstratehowyoucantakeadvantageofthetab
completionfeatureoftheIOSCLI.Thelabispreparedwiththedevicesthatarerepresentedinthetopology,butforthissessionyouwillonlybeusingSW2.Youwill
alsotakealookatCLIerrormessages.

Activity
Step1:OnSW2,usetheenablecommandtoaccessprivilegedEXEC.

SW2>enable
SW2#

Step2:Usethequestionmark(?)todisplayallthecommandsthatyoucanuseunderprivilegedEXEC.
Usethespacebartoscrollthroughtheentirelistoftheoutput.

SW2#?
Execcommands:
accessenableCreateatemporaryAccessListentry
accessprofileApplyuserprofiletointerface
accesstemplateCreateatemporaryAccessListentry
archivemanagearchivefiles
beepBlocksExtensibleExchangeProtocolcommands
calendarManagethehardwarecalendar
cdChangecurrentdirectory
clearResetfunctions
clockManagethesystemclock
cnsCNSagents
configureEnterconfigurationmode
connectOpenaterminalconnection
<...outputomitted...>
enableTurnonprivilegedcommands
eouEAPoUDP
More
<...outputomitted...>
Thelistisquitelong.Youhavetousethespacebarfourtimestogetthroughtheentirelist.
CLIHelp
Whenyouarelearninganewprogramorinterface,youusuallydependontheHelpfeaturestheprogramoffers.CiscoIOSSoftwareincludesextensivecommand
linehelpfunctions,includingcontextsensitivehelp.TherearetwobasictypesofCLIkeyboardhelpthattheCiscoIOSdevicesenable.Thefirstiscontext
sensitivehelp,whichoffersassistancewhenyouaretryingtodeterminethepropercommandandsyntax.Touseit,pressthequestionmark(?)key.Forexample,
youknowthatthecommandthatyouwanttousestartswithsh,butyouarenotsurewhattherestofthecommandis.Entersh?andyouarepresentedwithevery
commandthatstartswithshandthatyoucanuseinthecurrentprivilegemode.Youcanalsousecontextsensitivehelptofigureoutthesyntaxforacommand.
AnotheruseofthecontextsensitivehelpistogetalistofavailablecommandsforthecurrentCLImode.Thislistcanbeusedwhenyouareunsureofthenameof
acommandoryouwanttoseeifCiscoIOSSoftwaresupportsaparticularcommandinaparticularmode.Tousecontextsensitivehelpinthisway,enterthe
questionmark(?)atanyprompt.
TheothertypeoftheCLIkeyboardhelpistheerrormessages.WhenyouenteracommandintheCLI,thesyntaxischecked.Ifitisnotcorrect,youreceivean
errorthatstates"Invalidinputdetectedat'^'marker."Inadditiontothemessage,thecaretsymbol(^)isaddedbelowtheplaceinthecommandatwhichtheerror
wasdetected.Basically,CiscoIOSSoftwareissaying"Iunderstoodwhatyoutypeduptothispoint."
Youmayalsoreceiveanerrormessageforanambiguouscommand.Thistypeoferroroccurswhenyouuseanabbreviationforacommandandtheabbreviation
resultsinmultiplematches.InCiscoIOSSoftware,whenyoutypeenoughlettersthatmatchonlyonecommand,youmaypresstheEnterkey.Becausethereisno
othercommandthatstartswiththoseletters,CiscoIOSSoftwareexecutesthecommand.Forexample,assumethatthereareseveralcommandsthatstartwiththe
letter"c"butonlyonecommandthatbeginswith"clo."IfyoupressEnterafterenteringonlyc,youreceivean"ambiguouscommand"errormessage.However,if
youentercloandpressEnter,youdonotreceiveamessagethatthecommandisambiguousbecausetheclockcommandistheonlycommandthatstartswiththose
threeletters.However,youwouldreceivean"incompletecommand"errormessagebecauseclockisnotacompletecommand.Thismessagemeansthatyoudid
notenterenoughinformationforCiscoIOSSoftwaretounderstandwhatyouwererequesting.
ThisfunctionalitymayvaryacrossCiscoIOSplatforms.
ThequestionmarkisyourfriendwhenyouareusingtheCLI.ItisimpossibletorememberthesyntaxforeveryCiscoIOScommand,sobesuretousethistool.

TypeofCLIHelp Description
Contextsensitivehelp Providesalistofcommandsandtheargumentsthatareassociatedwithaspecificcommand.
Consoleerrormessage Identifiesproblemswithcommandsthatyouhaveincorrectlyenteredsothatyoucanalterorcorrectthem.

Howtoutilizecontextsensitivehelp?

WordHelp
Togetwordhelp,enteracharactersequencefollowedimmediatelybyaquestionmark.Donotincludeaspacebeforethequestionmark.Thedevicethen
displaysalistofcommandsthatstartwiththecharactersthatyouentered.
CommandSyntaxHelp
Togetcommandsyntaxhelp,enteraquestionmarkafteracommandnameinplaceofakeywordorargument.Includeaspacebeforethequestionmark.For
example,entershow?togetalistofthecommandoptionsthattheshowcommandsupports.Thenetworkdevicethendisplaysalistofavailablecommand
options,withstandingforcarriagereturn.Youcanaccesscommandsyntaxhelpafteranycommandorcommandoptiontohelpyoudeterminewhatyoucanor
shouldenternext.

Step3:Listonlythecommandsthatstartwiththeletter"s"byenterings?onthecommandline.

SW2#s?
*s=show
sdlcsendsetsetup
showslipspecfilessh
startchatsystat

Theoutputshowsthatthereisanexceptiontonormalcommandparsingrules.TheCLIwillinterprettheletter"s"allbyitselfas"show".Thisfeatureisspecific
tothedeviceandoperatingsystemversion.WhileitwillworkonSW2,itmaynotworkonalldevices.Abbreviating"show"withthecharacters"sh"isgoingto
beeffectivemoreconsistentlyacrossIOSdevices.
Step4:Tryoutthetabcompletionfeature.
Likecommandabbreviation,tabcompletionworksaslongasyouhaveenteredenoughcharacterstoremoveambiguity.Typeshandthenpressthetabkey.
TheCLIparserexpandstheunambiguousabbreviationintothefullcommand.

https://cll1.cisco.com/content/xtrac/2 2/9
31/3/2017 Procedure
SW2#sh
SW2#show

Step5:Youmightfindtabcompletionhelpfulbecauseitpreventsyoufromattemptingtousecommandabbreviationand
accidentallyabbreviatetoomuch.
Iftherearemultiplematchesfortheabbreviation,tabcompletionwillnotwork.Ifyouarenotsurewhy,youcanalwaysusethequestionmark(?)atthatpoint.
Demonstratethisexamplebyattemptingtoabbreviatetheconfigurecommandwith"con".
Whenyoutriedtousethetabtocompletetheabbreviation"con,"itdidnotwork.Thecommandparsersimplyredisplayed"con".Usingthequestionmark(?)at
thatpointshowsthattherearetwocommandsthatbeginwith"con".Tobeunambiguous,youmustuseatleast"conf"asyourabbreviationforconfigure.

SW2#con
SW2#con?
configureconnect
SW2#con

Step6:Youwillnotgointotheconfigurationmodeduringthissession.UsetheBackspacekeytodeletethe"con"thatiscurrently
ontheCLIinputline.
Step7:Youhavejustdemonstratedthatthequestionmark(?)andtabcompletionworkforcommands.
Theyarealsohelpfulforargumentstocommands.Forexample,ifyouwanttodisplayalltheargumentsthatyoucanusewiththeshowcommand,usethe
questionmark(?)andseparateitfromtheshowcommandbyaspace.

SW2#show?
aaaShowAAAvalues
accessexpressionListaccessexpression
<...outputomitted...>
More
<...outputomitted...>
Therearealotofshowcommands.Toscrollthroughtheentirelistyouhavetopressthespacebarninetimes.
Step8:Justlikewithcommands,youcancombinesomeexplicitcharactersfollowedbythequestionmarktodisplayasubsetofthe
argumentoptions.
Forexample,useshowr?todisplayalltheshowcommandoptionsthatstartwiththeletter"r".

SW2#showr?
radiusregionregistryreload
resourcerhostsribrif
routemaproutetagrunningconfig

Step9:Experimentwithcommandabbreviationandtabcompletionincreativeways,untilyoufeelyouarecomfortableusingthem.
Youcanseeoneexampleforshowrunningconfig,butstill,feelfreetoexperimentindependently.

SW2#sh
SW2#showrun
SW2#showrunningconfig
Buildingconfiguration...

Currentconfiguration:865bytes
!
version15.1
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
noservicepasswordencryption
servicecompressconfig
<...outputomitted...>
Youmayalsofindtabcompletionusefulifyouareworkingwithsomeoneelse.IfyouaretypingattheCLI,youmayunderstandsomecommandabbreviations
thatyourpartnerdoesnot.Usingcommandcompletionallowsyourpartnertoseetheentirecommandverbiage.
CLIErrorMessages
Youdidnotenterenoughcharacters.
SW1#c
%Ambiguouscommand:'c'
Requiredargumentsorkeywordswereomittedattheendofthecommand.
SW1#clockset
%Incompletecommand
SW1#clockset19:50:00
%Incompletecommand
Thecaret(^)indicatestheplacewherethecommandinterpretercannotdecipherthecommand.
SW1#clockset19:50:00256
^
%Invalidinputdetectedat"^"marker
Usethe?commandtocorrectlysetsystemclock.
SW1#clockset19:50:00256?
%Unrecognizedcommand
SW1#clockset19:50:0025Jun
%Incompletecommand.

SW1#clockset19:50:0025Jun?
<19932035>Year

SW1#clockset19:50:0025Jun2015?

SW1#clockset19:50:0025Jun2015
SW1#
*Jun2603:50:00.000:%SYS6CLOCKUPDATE:Systemclockhasbeenupdatedfrom04:33:42PSTWedOct72015to19:50:00PSTThuJun252015,configuredfromconsolebyconsole.

Therearethreetypesofconsoleerrormessages:

Ambiguouscommand
Incompletecommand
Incorrectcommand

ErrorMessage Meaning HowtoGetHelp


%Ambiguouscommand:"show Youdidnotenterenoughcharactersforyour Reenterthecommand,followedby?withoutaspacebeforeit.TheCLI
con" devicetorecognizethecommand. displayspossiblekeywordsthatyoucanenterwiththecommand.
%Incompletecommand Youdidnotenterallthekeywordsorvaluesthat Reenterthecommand,followedby?withaspacebeforeit.
arerequiredbythiscommand.
%Invalidinputdetectedat^ Youenteredthecommandincorrectly.The^ Enter?todisplayallthecommandsorparametersthatyoucanuse.
marker marksthepointoftheerror.
Thecommandhistorybufferstoresthecommandsthathavebeenmostrecentlyentered.Toseethesecommands,entertheCiscoIOSshowhistorycommand.
Youcanusecontextsensitivehelptodeterminethesyntaxofaparticularcommand.Forexample,ifthedeviceclockneedstobesetbutyouarenotsureofthe
clockcommandsyntax,thecontextsensitivehelpprovidesameanstocheckthesyntax.
Contextsensitivehelpsuppliesthewholecommandevenifyouenterjustthefirstpartofthecommand,suchascl?.
Ifyouenterthecommandclockbutanerrormessageisdisplayed,indicatingthatthecommandisincomplete,enterthe?command(precededbyaspace)to
determinewhichargumentsarerequiredforthecommand.Intheclock?example,thehelpoutputshowsthatthekeywordsetisrequiredafterclock.
Ifyounowenterthecommandclocksetbutanothererrormessageappears,indicatingthatthecommandisstillincomplete,presstheUpArrowkeytorepeatthe
commandentry.Then,addaspaceandenterthequestionmark(?)todisplayalistofargumentsthatyoucanuseforthecommand.
Theexampleshowsthatafterthelastcommandrecall,theadministratorusedthe?torevealadditionalarguments,whichinvolveenteringthecurrenttimeusing
correctformofmonthandyear..
Thefigurecontinuestoillustratehowtosetthedeviceclock.
IfafterenteringthecurrenttimeyoustillseetheCiscoIOSSoftwareerrormessageindicatingthatthecommandthatyouhaveenteredisincomplete,recallthe
command,addaspace,andenterthe?commandtodisplayalistofargumentsthatareavailableforthecommand.Inthisexample,entertheday,month,andyear
usingthecorrectsyntax.ThenpressEntertoexecutethecommand.
Syntaxcheckingusesthecaretsymbol(^)asanerrorlocationindicator.Itappearsatthepointinthecommandstringwheretheuserhasenteredanincorrect
command,keyword,orargument.Theerrorlocationindicatorandinteractivehelpsystemprovideawaytoeasilyfindandcorrectsyntaxerrors.Intheclock
https://cll1.cisco.com/content/xtrac/2 3/9
31/3/2017 Procedure
command,keyword,orargument.Theerrorlocationindicatorandinteractivehelpsystemprovideawaytoeasilyfindandcorrectsyntaxerrors.Intheclock
example,thecaretsymbolindicatesthatthemonthwasenteredincorrectlyasanumber.Theparserisexpectingthemonthtobespelledout.

Task3:ManageCiscoIOSConfiguration
NowyouwillgothroughthestartupandrunningconfigurationsonaCiscoIOSdevice.Thelabispreparedwiththedevicesthatarerepresentedinthetopology,but
forthissessionyouwillonlybeusingSW2.Intheend,youwillerasetheconfigurationonSW2.Donotworry,though.Thelabsystemwillreturntheconfigurations
thenexttimethelabisinitialized.
Thepromptdisplaysthehostnamethatisconfiguredonthedevice.Youwillmodifythiscomponentoftheswitchconfigurationasyouexperimentwiththestartupand
runningconfigurations.

Activity
Step1:OnSW2,entertheglobalconfigurationmodeandchangethehostnameoftheswitchto"Temp"andreturntoprivileged
EXEC.
Immediatelyafteryouchangethehostnamesettingontheswitch,thesystempromptreflectsthenewname.

SW2#configureterminal
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
SW2(config)#hostnameTemp
Temp(config)#end
Temp#
Youjustmodifiedtherunningconfigurationontheswitch.Thestartupconfigurationhasnotchanged.
Step2:Displaytherunningconfigurationthatisparsedthroughtheincludefilter,showingonlythelinesthatincludethestring
"hostname".
Theuseoftabcompletionandthequestionmarkisintendedtoremindyouthattheseoptionsarealwaysavailabletoyou.Theywillnotbedemonstratedany
furtherinthissession,butfeelfreetotakeadvantageofthematanytime.

Temp#sh
Temp#showr?
radiusregionregistryreload
resourcerhostsribrif
routemaproutetagrunningconfig

Temp#showrun
Temp#showrunningconfig|inc
Temp#showrunningconfig|includehostname
hostnameTemp
Tabcompletionwasavailableforshowandrunningconfigandinclude,butnotforhostname,becausehostnameisafreeformvariable.Itcanbeanystring.
ThereisnowayfortheCiscoIOSparsertoguesswhatyouwantthatstringtobe.
Theonelineintheconfigurationthatincludesthestringhostnameisthehostnamecommandsettingthehostnameto"Temp."
ManagingCiscoIOSConfiguration
Whenaswitchorarouterstarts,itlooksforaconfigurationfileintheNVRAMofthedevice.NVRAMisthememoryinthedevicethatretainsinformationeven
whenthedeviceispowereddown.TheconfigurationfilethatisstoredinNVRAMiscalledthestartupconfigfile.IfthereisnostartupconfigfileinNVRAM,the
routerorswitchentersthesetuputilityandloadsablankconfiguration.Thesetuputilitypromptsyouattheconsoleforspecificconfigurationinformationtocreate
abasicinitialconfigurationontherouterorswitch.Youcanalsointerruptthesetuputilityandstartconfiguringthedevicemanually.
Oncethedevicehasstarted,thesystemcopiesthestartupconfigurationtoRAM.TheconfigurationfileinRAMiscalledtherunningconfigfile.Asyoumake
additionalconfigurations,thesystemstoresthemintherunningconfiguration.ItisimportanttounderstandthatRAMdoesnotretainitsinformationwhenthe
deviceispoweredofforrebooted.Ifachangeismadetotherunningconfiguration,itmustbecopiedtothestartupconfiguration,whichisstoredintheNVRAM,
forittoberetainedafterareboot.
InadditiontoNVRAMandRAM,Ciscodeviceshaveathirdtypeofmemory,calledflashmemory.Flashmemoryissimilartoaharddriveinthattheinformation
thatthesystemstoresthereisretainedevenwhenthedeviceispoweredoff.CiscoIOSSoftwareisstoredinflashmemory.Flashmemorymayalsostorebackup
configurationfilesandadditionaldevicesupportedfiles.

Toviewtheconfigurationfiles,usetheshowcommandfollowedbythenameofthefile.Forexample,ifyouwanttoviewtheconfigurationthatisstoredinRAM,
typeshowrunningconfig.Tosavetherunningconfiguration,copyittoNVRAM.Todoso,usethecopycommandfollowedbythenamesofthesourceand
destinationfiles.Thecompletecommandiscopyrunningconfigstartupconfig.ReviewthetableforadditionalcommonlyusedCiscoIOScommands.

CommonIOSManagement
Command Function
showrunningconfig Displaysthecurrentrunningconfiguration.Youcanalsousefilters.Forexample,youcanusetheshowrunningconfiginterface
GigabitEthernet0/1commandtodisplayonlytheinterfaceGigabitEthernet0/1runningconfiguration.
showstartupconfig DisplaysthesavedconfigurationinNVRAM.
configureterminal Enterstheconfigurationmode,whereyoucaninteractivelycreateconfigurationsinRAMfromtheconsoleorremoteterminal.
copyrunningconfig SavestherunningconfigurationtoNVRAM.
startupconfig
copystartupconfig StartupconfigurationinNVRAMismergedintorunningconfiguration.
runningconfig
erasestartupconfig DeletesthesavedstartupconfigfileinNVRAM.
YoucanalsousethecopycommandtocopyconfigurationfilesandCiscoIOSSoftwarefilesfromaswitchoraroutertoaserver(orviceversa)usingFTP,SCP,
HTTP,TFTP,andotherprotocols.Forexample,inthecopyrunningconfigtftp:command,thesystemcopiestherunningconfigurationinRAMtoaTFTPserver.
YoumustsupplytheIPaddressornameoftheTFTPserverandadestinationfilename.Duringthecopyingprocess,aseriesofexclamationmarksshowthe
progressoftheupload.

https://cll1.cisco.com/content/xtrac/2 4/9
31/3/2017 Procedure

Copyingconfigurationfilesfromaswitchoraroutertoaserverisusefulforbackinguptheconfigurationfilesandforcentralizedmanagementpurposes.
Regardlessofthesizeofthenetwork,thereshouldalwaysbeacopyofthecurrentrunningconfigurationonlineasabackup.
CopyingconfigurationfilesfromanexternalservertotherunningconfigurationinRAMortothestartupconfigurationfileinNVRAMoftherouterorswitchis
usefulforrestoringbackups.Youshouldcopythefilestoadeviceotherthantheonethattheywerecreatedon.
WhenyoucopyaconfigurationintoRAMfromanysource,theconfigurationmergeswiththeexistingconfigurationinRAM.Newconfigurationparametersare
added,andchangestoexistingparametersoverwritetheoldparameters.ConfigurationcommandsinRAMforwhichthereisnocorrespondingcommandin
NVRAMremainunaffected.
Step3:Nowdisplaythestartupconfigurationthatisparsedthroughtheincludefilter,showingonlythelinesthatincludethestring
"hostname".
Whenyoumakechangestotherunningconfiguration,itdoesnotaffectthestartupconfiguration.ThestartupconfigurationstillhasSW2configuredasthe
hostname.

Temp#showstartupconfig|includehostname
hostnameSW2

Step4:Usethereloadcommandwhichwillreboottheswitch.Thisactionwillcausetheswitchtothrowawaytherunning
configurationandreadthestartupconfigurationfromscratch.
Answernotothequeryaboutsavingthemodifiedconfiguration.Thegoalistodemonstratehowtoreturntotheoldconfiguration.Ifyousavethemodified
configuration,thesystemwilloverwritetheoldconfiguration.
Afterthereload,asindicatedbythesystemprompt,thehostnamehasreturnedtoSW2.

Temp#reload

Systemconfigurationhasbeenmodified.Save?[yes/no]:no
Proceedwithreload?[confirm]
<...outputomitted...>
PressRETURNtogetstarted!
<...outputomitted...>
SW2>
Tomakechangestotherunningconfigurationpermanent,youhavetosavetherunningconfigurationoverthestartupconfiguration.
Step5:Changethehostnameonemoretime.
Thistime,setthehostnameto"ThisWillStick."

SW2>enable
SW2#configureterminal
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
SW2(config)#hostnameThisWillStick
ThisWillStick(config)#end
ThisWillStick#

Step6:Copytherunningconfigurationoverthestartupconfiguration.

ThisWillStick#copyrunningconfigstartupconfig
Destinationfilename[startupconfig]?
Buildingconfiguration...

Compressedconfigurationfrom936bytesto641bytes[OK]
ThisWillStick#
Afterthiscopyoperation,thechangetothehostnameisreflectedinthestartupconfigurationandwillnowbeabletosurviveareloadevent.
Optionally,youcanusetheshowstartupconfigurationcommandtoverifythatthechangeisreflectedthere.
Step7:Usethereloadcommandagain,andverifythatthenewhostnamesettingisstillinplaceaftertherebootevent.

ThisWillStick#reload
Proceedwithreload?[confirm]
<...outputomitted...>
PressRETURNtogetstarted!
<...outputomitted...>
ThisWillStick>
Thehostnamedoes,indeed,remainasThisWillStick.
Step8:Nowerasethestartupconfigurationwiththeerasestartupconfigcommand.

ThisWillStick>enable
ThisWillStick#erasestartupconfig
Erasingthenvramfilesystemwillremoveallconfigurationfiles!Continue?[confirm]
[OK]
Eraseofnvram:complete
*Jul608:40:12.990:%SYS7NV_BLOCK_INIT:Initializedthegeometryofnvram
ThisWillStick#
Eventhoughthesystemerasedthestartupconfiguration,thisactiondoesnothaveaneffectontherunningconfiguration.Infact,(donotdothisnow)youcould
usethecopyrunningconfigstartupconfigcommandnowtoputthestartupconfigurationbacktothewayitwas.
Step9:Verifythatthesystemactuallyerasedthestartupconfigurationusingshowstartupconfig.

ThisWillStick#showstartupconfig
startupconfigisnotpresent

Step10:Reloadtheswitch.
Understandthattheswitchwillattempttoreadthestartupconfigurationandfinditmissing.Thissituationwillessentiallysettheswitchbacktothefactory
defaultstate.Donotworry,whenthelabisreinitialized,thelabsystemwillsetalldeviceconfigurationsappropriately.

ThisWillStick#reload
Proceedwithreload?[confirm]
<...outputomitted...>
PressRETURNtogetstarted!
Switch>

Step11:Verifythatthehostnamesettingintherunningconfigurationisthedefaultvalue(Switch).

Switch>enable
Switch#showrunningconfig|includehostname
hostnameSwitch
Switch#

Task4:ImproveUserExperienceinCLI
Inthissession,youwillbeabletopracticeusingterminalhistory.Recallingpreviouscommandsisusefulsimplytoreducetyping.Whenyourecallacommand,you
cansimplypressEntertousetheexactsamecommand,oryoucaneditittosuityournewpurpose.Thelabispreparedwiththedevicesthatarerepresentedinthe
topology,butforthissessionyouwillonlybeusingR1.
Thepromptdisplaysthehostnamethatisconfiguredonthedevice.Youwillmodifythiscomponentoftherouterconfigurationasyouexperimentwiththestartupand
runningconfigurations.

Activity
Step1:OnR1,usetheenablecommandtoaccesstheprivilegedEXEC.

https://cll1.cisco.com/content/xtrac/2 5/9
31/3/2017 Procedure

R1>enable
R1#

Step2:Enterthesequenceofcommandsthatareshownbelow.
Thesequenceisratherarbitrary.TheselectioncriteriaweretoincludethreeEXECcommandsandtwoconfigurationmodecommands.Donotbeconcernedif
thecommandsarenewtoyou.Thispartwillsimplygiveyoualittlebitofdataintheterminalhistory.

showiproute(inprivilegedEXECmode)
showclock(inprivilegedEXECmode)
showipinterfacebrief(inprivilegedEXECmode)
configureterminal(togoinglobalconfigurationmode)
clocktimezoneEST0(inglobalconfigurationmode)
noipdomainlookup(inglobalconfigurationmode)

R1#showiproute
Codes:Llocal,Cconnected,Sstatic,RRIP,Mmobile,BBGP
DEIGRP,EXEIGRPexternal,OOSPF,IAOSPFinterarea
N1OSPFNSSAexternaltype1,N2OSPFNSSAexternaltype2
E1OSPFexternaltype1,E2OSPFexternaltype2
iISIS,suISISsummary,L1ISISlevel1,L2ISISlevel2
iaISISinterarea,*candidatedefault,Uperuserstaticroute
oODR,Pperiodicdownloadedstaticroute,HNHRP,lLISP
+replicatedroute,%nexthopoverride

Gatewayoflastresortisnotset

10.0.0.0/8isvariablysubnetted,4subnets,2masks
C10.10.1.0/24isdirectlyconnected,Ethernet0/0
L10.10.1.1/32isdirectlyconnected,Ethernet0/0
C10.10.3.0/24isdirectlyconnected,Loopback0
L10.10.3.1/32isdirectlyconnected,Loopback0

R1#showclock
*00:47:02.857PSTMonJul62015

R1#showipinterfacebrief
InterfaceIPAddressOK?MethodStatusProtocol
Ethernet0/010.10.1.1YESNVRAMupup
Ethernet0/1unassignedYESNVRAMadministrativelydowndown
Ethernet0/2unassignedYESNVRAMadministrativelydowndown
Ethernet0/3unassignedYESNVRAMadministrativelydowndown
Serial1/0unassignedYESNVRAMadministrativelydowndown
Serial1/1unassignedYESNVRAMadministrativelydowndown
Serial1/2unassignedYESNVRAMadministrativelydowndown
Serial1/3unassignedYESNVRAMadministrativelydowndown
Loopback010.10.3.1YESNVRAMupup

R1#configureterminal
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
R1(config)#clocktimezoneEST0
*Jul608:48:41.931:%SYS6CLOCKUPDATE:Systemclockhasbeenupdatedfrom00:48:41PSTMonJul62015to08:48:41ESTMonJul62015,configuredfromconsolebyconsole.
R1(config)#noipdomainlookup

ImprovingUserExperienceinCLI
TheCiscoIOSCLIincludesmanyfeaturesthatmaketheconfigurationprocesseasierandfaster.Thesefeaturesincludecommandlineeditingkeys,command
history,andfilteringparameters.
CommandLineEditingKeys
CommandlineeditingkeysareshortcutsandhotkeysthattheCLIprovides.Usetheseshortcutsandhotkeystomovethecursoraroundonthecommandlinefor
correctionsorchanges.Usethemalsotomakeconfiguring,monitoring,andtroubleshootingeasier.Thetabledescribeseachoftheshortcutsforcommandline
editingandcontrollingcommandentry.

CommandLineEditingKeySequence Description
CtrlA Movesthecursortothebeginningofthecommandline
CtrlC Abortsthecurrentcommandandexitstheconfigurationmode
CtrlE Movesthecursortotheendofthecommandline
EscB Movesthecursorbackoneword
EscF Movesthecursorforwardoneword
CtrlB Movesthecursorbackonecharacter
CtrlF Movesthecursorforwardonecharacter
CtrlD Deletesasinglecharacteratthecursor
Backspace Removesonecharactertotheleftofthecursor
CtrlP Redisplaysthecurrentcommandline
CtrlU Erasesaline
CtrlW Erasesawordtotheleftofthecursor
CtrlZ EndsconfigurationmodeandreturnstotheEXECprompt
Tab Completesapartiallyenteredcommandifenoughcharactershavebeenenteredtomakeitunambiguous
CtrlShift6 AllowstheusertointerruptaCiscoIOSprocesssuchaspingortraceroute
CtrlPorUpArrow Recallslast(previous)commands
CtrlNorDownArrow Recallsmorerecentcommands
TheEsckeyisnotfunctionalonallterminals.
CommandHistory
TheCiscoCLIprovidesahistoryorrecordofcommandsthatusershaveentered.Youwillfindthisfeature,whichiscalledthecommandhistory,particularlyuseful
inhelpingyoutorecalllongorcomplexcommandsorentries.

Withthecommandhistoryfeature,youcancompletethefollowingtasks:

Displaythecontentsofthecommandbuffer:Bydefault,commandhistoryisenabled,andthesystemrecordsthelast10commandlinesinitshistorybuffer.
Setthecommandhistorybuffersize:Tochangethenumberofcommandlinesthatthesystemwillrecordduringthecurrentterminalsessiononly,usethe
terminalhistorycommandinuserEXECmode.
Recallpreviouslyenteredcommandsthatarestoredinthehistorybuffer:ThereisabufferforEXECmodeandanotherbufferfortheconfigurationmode.
Torecallcommandsinthehistorybuffer,pressCtrlPortheUpArrowkey.Thecommandoutputbeginswiththemostrecentcommand.Repeatthekey
sequencetorecallsuccessivelyoldercommands.
Toreturntomorerecentcommandsinthehistorybuffer(afterrecallingoldercommandswithCtrlPortheUpArrowkey),pressCtrlN,ortheDownArrow
key.Repeatthekeysequencetorecallsuccessivelymorerecentcommands.
Onmostcomputers,thereareadditionalselectandcopyfunctionsavailable.Copyapreviouscommandstring,thenpasteorinsertitasthecurrentcommand
entry,andpressEnter.
Whenyouuseshowcommandssuchasshowrunningconfig,CiscoIOSSoftwareautomaticallypauseswhendisplayingtheoutputafteraspecifiednumberof
lines.Theprocessofdisplayingtheoutputpauses,andCiscoIOSSoftwaredisplays"More."Itthenwaitsforuserinputtocontinuewiththedisplayprocess.
YoucanpresstheSpacebarkeytodisplayanothersetofsubsequentlinesorpressEntertodisplayasingleline.
Setthenumberoflinesonthecurrentterminalscreen:Youcanusetheterminallengthcommand,followedbyanumber,tocontrolthenumberoflinesthat
theCLIdisplayswithoutpausingduringtheoutput.Avalueofzeropreventstherouterfrompausingbetweenscreensofoutput.Bydefault,thevalueissetto24.

Step3:Now,whileremainingintheconfigurationmode,usetheUpArrowandDownArrowkeystoscrollthroughtheterminal
historybuffer.
NotethatyoudonotseetheEXECcommands.ThereisaseparateterminalhistorybufferforconfigurationandEXECmodes.
Step4:Leavetheconfigurationmode(useend,exit,orpressCtrlZ)toreturntoprivilegedEXEC.
Step5:AgainusetheUpArrowandDownArrowkeystoshowthatyoucanrecallpreviouscommands.
Step6:RecalltheshowiproutecommandandthenpresstheEnterkeytoresubmititwithoutanyedits.
ItisacommonexercisetorevisitshowcommandsthatdisplayoperationalstatusasyoumakechangestotheconfigurationsonIOSdevicesandtheirneighbors.
Step7:Now,typethefollowingcommand,purposelymistyping"show"as"snow."
https://cll1.cisco.com/content/xtrac/2 6/9
31/3/2017 Procedure
Step7:Now,typethefollowingcommand,purposelymistyping"show"as"snow."

R1#snowipinterfacebrief
^
%Invalidinputdetectedat'^'marker.
Everyonemakestypographicalerrors.Dealingwiththemisoneofthebestusesoftheterminalhistoryandthecommandlineeditingtools.
Step8:Followthissequencetoquicklyandeasilycorrectthetypographicalerrorandresubmitthecorrectedcommand:
PresstheUpArrowkeyoncetoretrievethepreviouscommand.
PressCtrlAtomovethecursortothebeginningoftheline.
PresstheRightArrowtwicetomovethecursortotherightoftheincorrectletter"n."
PressBackspacetoerasetheletter"n."
Presshtoinsertthecorrectletter"h."
PressEntertoresubmitthecorrectedcommand.

Step9:Returntotheglobalconfigurationmode.

R1#configureterminal
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
R1(config)#
Asbefore,youwillbeusingcommandsthatyouarenotfamiliarwithtofacilitatethedemonstrationofthepoweroftheterminalhistorybuffer.Donotconcern
yourselfwithcommandsthemselves.Instead,focusonhowbeneficialtheterminalhistorybuffercanbe.
Step10:ConfigurethedescriptionofinterfaceSerial1/0andenabletheinterfacebyoverridingthedefaultshutdowncommand.

R1(config)#interfaceSerial1/0
R1(configif)#descriptionLinktoSP1
R1(configif)#noshutdown
*Jul608:51:13.776:%LINK3UPDOWN:InterfaceSerial1/0,changedstatetoup
*Jul608:51:14.780:%LINEPROTO5UPDOWN:LineprotocolonInterfaceSerial1/0,changedstatetoup
R1(configif)#

Step11:RepeataverysimilarconfigurationforinterfaceSerial1/1.

Thefollowingprocesscanmakethistaskrelativelyeasy:

PresstheUpArrowkeythreetimestorecalltheinterfacecommand.Editthe1/0tobe1/1andpresstheEnterkeytoresubmittheeditedcommand.
PresstheUpArrowkeythreetimes,torecallthedescriptioncommand,edittheSP1tobeSP2andpresstheEnterkeytoresubmittheeditedcommand.
PresstheUpArrowkeythreetimes,torecallthenoshutdowncommand,andpresstheEnterkeytoresubmitthecommandwithoutanyediting.

Theresultingsequenceshouldlooklikethefollowingexample:

R1(config)#interfaceSerial1/1
R1(configif)#descriptionLinktoSP2
R1(configif)#noshutdown
*Jul609:02:22.638:%LINK3UPDOWN:InterfaceSerial1/1,changedstatetoup
*Jul609:02:23.642:%LINEPROTO5UPDOWN:LineprotocolonInterfaceSerial1/1,changedstatetoup
R1(configif)#

Step12:Leavetheconfigurationmodebyusingend,exit(2times),orpressingCtrlZtoreturntoprivilegedEXEC.

Optionally,youcansavetherunningconfigurationtothestartupconfiguration,butitisnotnecessaryintheautomatedlabenvironment.
FilteringParameters
AnotherusefulfeaturethatimprovestheuserexperienceintheCLIisthefilteringofshowoutputs.Usingfiltering,youcandisplayonlythepartsofshowoutputs
thatyouareinterestedin.Youcanfilteroutputsbytypingthepipe(|)characterafterashowcommand,followedbyafilteringparameterandafilteringexpression.
Thetabledescribesfilteringparametersthatareavailableforoutputfiltering.

Parameter Description
begin Showsalloutputlines,startingwiththelinethatmatchesthefilteringexpression
exclude Excludesalloutputlinesthatmatchthefilteringexpression
include Includesalloutputlinesthatmatchthefilteringexpression
section Showstheentiresectionthatstartswiththefilteringexpression

Step13:OntheR1routerusebeginandincludeoptionswithshowrunningconfigcommandandfilteringexpressioninterface.
Youshouldseefollowingoutputwhenusingbeginoption:

R1#showrunningconfig|begininterface
interfaceLoopback0
ipaddress10.10.3.1255.255.255.0
!
interfaceEthernet0/0
descriptionLinktoSW2
ipaddress10.10.1.1255.255.255.0
!
interfaceEthernet0/1
noipaddress
shutdown
!
interfaceEthernet0/2
noipaddress
shutdown
!
interfaceEthernet0/3
noipaddress
shutdown
!
interfaceSerial1/0
noipaddress
shutdown
serialrestartdelay0
!
interfaceSerial1/1
noipaddress
shutdown
serialrestartdelay0
!
interfaceSerial1/2
noipaddress
shutdown
serialrestartdelay0
!
interfaceSerial1/3
noipaddress
shutdown
serialrestartdelay0
!
ipforwardprotocolnd
!
!
noiphttpserver
noiphttpsecureserver
!
!
!
!
controlplane
!
!
!
!

https://cll1.cisco.com/content/xtrac/2 7/9
31/3/2017 Procedure
!
!
!
!
linecon0
loggingsynchronous
lineaux0
linevty04
login
transportinputall
!
!
end
Youshouldseefollowingoutputwhenusingincludeoption:

R1#showrunningconfig|includeinterface
interfaceLoopback0
interfaceEthernet0/0
interfaceEthernet0/1
interfaceEthernet0/2
interfaceEthernet0/3
interfaceSerial1/0
interfaceSerial1/1
interfaceSerial1/2
interfaceSerial1/3

Step14:OntheR1routerusesectionoptionwithshowrunningconfigcommandandfilteringexpressioninterface.
Youshouldseefollowingoutputwhenusingsectionoption:

R1#showrunningconfig|sectioninterface
interfaceLoopback0
ipaddress10.10.3.1255.255.255.0
interfaceEthernet0/0
descriptionLinktoSW2
ipaddress10.10.1.1255.255.255.0
interfaceEthernet0/1
noipaddress
shutdown
interfaceEthernet0/2
noipaddress
shutdown
interfaceEthernet0/3
noipaddress
shutdown
interfaceSerial1/0
noipaddress
shutdown
serialrestartdelay0
interfaceSerial1/1
noipaddress
shutdown
serialrestartdelay0
interfaceSerial1/2
noipaddress
shutdown
serialrestartdelay0
interfaceSerial1/3
noipaddress
shutdown
serialrestartdelay0

Step15:OntheR1routeruseexcludeoptionwithshowrunningconfigcommandandfilteringexpression!.
Youshouldseefollowingoutputwhenusingexcludeoption:

R1#showrunningconfig|exclude!
Buildingconfiguration...

Currentconfiguration:1223bytes
version15.2
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
noservicepasswordencryption
hostnameR1
bootstartmarker
bootendmarker
noaaanewmodel
clocktimezonePST80
mmipollinginterval60
nommiautoconfigure
nommipvc
mmisnmptimeout180


noipdomainlookup
ipcef
noipv6cef
multilinkbundlenameauthenticated
redundancy
interfaceLoopback0
ipaddress10.10.3.1255.255.255.0
interfaceEthernet0/0
descriptionLinktoSW2
ipaddress10.10.1.1255.255.255.0
interfaceEthernet0/1
noipaddress
shutdown
interfaceEthernet0/2
noipaddress
shutdown
interfaceEthernet0/3
noipaddress
shutdown
interfaceSerial1/0
noipaddress
shutdown
serialrestartdelay0
interfaceSerial1/1
noipaddress
shutdown
serialrestartdelay0
interfaceSerial1/2
noipaddress
shutdown
serialrestartdelay0
interfaceSerial1/3
noipaddress
shutdown
serialrestartdelay0
ipforwardprotocolnd
noiphttpserver
noiphttpsecureserver
controlplane
linecon0
loggingsynchronous
lineaux0
https://cll1.cisco.com/content/xtrac/2 8/9
31/3/2017 Procedure
lineaux0
linevty04
login
transportinputall
end

2016CiscoSystems,Inc.

https://cll1.cisco.com/content/xtrac/2 9/9