WP CI CiscoIOSCommandShortcuts

Embed Size (px)

Citation preview

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    1/12

    Expert Reerence Series o White Papers

    1-800-COURSES www.globalknowledge.com

    Cisco IOS CommandShortcuts

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    2/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 2

    Cisco IOS Command ShortcutsRaj Tolani, Global Knowledge Instructor

    IntroductionOnce you start using the Cisco IOS, you learn there are many commands that can do various things, and manyo these have parameters and even sub-parameters. This could be very cumbersome i you are managing CiscoRouters in real lie (especially or the typing challenged among us). This white paper contains some tips andshortcuts Ive collected over the years that will make your lie a little easier.

    Note: The goal in this white paper is not to teach you what the commands do or show. Instead, I am simplyshowing you how the addition o parameters to these commands will make your lie easier. For example, i Ishow you the BGP command to restrict your output and specifcally see certain components we assume you al-ready understand BGP. We will not be covering the output to go into the BGP parameters (or any other protocolused in these examples).

    Show running-confgMany o us have been using the Show running-confg command. We know that this will show us what iscurrently running. But i I only wanted to see what was currently running or a specifc interace, then it makessense to see just the part that pertains to that particular interace, rather than the entire running-confg,

    which could be multiple pages. Lets see the example.

    Here is the output o show running-confg on a simple router

    Building conguration...

    Current conguration : 728 bytes

    version 12.4

    service timestamps debug datetimemsec

    service timestamps log datetimemsec

    no service password-encryption

    hostname Router

    boot-start-marker

    boot-end-marker

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    3/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 3

    noaaa new-model

    memory-sizeiomem 5

    ipcef

    ipauth-proxy max-nodata-conns 3

    ip admission max-nodata-conns 3

    interface FastEthernet0/0ip address 1.1.1.1 255.255.255.0

    duplex auto

    speed auto

    interface FastEthernet0/1

    ip address 2.2.2.1 255.255.255.0

    duplex auto

    speed auto

    ip forward-protocol nd

    ip http server

    no ip http secure-server

    control-plane

    line con 0

    password cisco

    login

    line aux 0

    no exec

    linevty 0 4

    password cisco

    login

    end

    But, i I only care about the output o the confguration or interace FastEthernet 0/1, then I would do the ol-lowing instead.

    Router#show runint fa 0/1

    Building conguration...

    Current conguration : 92 bytes

    interface FastEthernet0/1ip address 2.2.2.1 255.255.255.0

    duplex auto

    speed auto

    end

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    4/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 4

    This makes things easy since I can ocus on the output or that specifc interace confguration. Sometimes, Idont care about all pages in the running confguration, I just care about output starting with the line that saysline con 0. Instead o looking at the entire multiple-page running-confg I would rather do the ollowing.

    Router#show run | begin line con 0

    line con 0

    password ciscologin

    line aux 0

    no exec

    linevty 0 4

    password cisco

    login

    end

    This is great! I only see the output beginning rom line con 0 in the confguration. But, or some, even this

    might be too much inormation. Maybe I only care about the section that pertains to line con 0.To make that happen, I would do the ollowing.

    Router#show run | section line con 0

    line con 0

    password cisco

    login

    Router#

    I like the command with the parameter section at the end because it helps me out with routing protocols too.Let me give you an example o what I mean.

    Router#show run | section router eigrp

    routereigrp 100

    network 1.0.0.0

    network 2.0.0.0

    auto-summary

    Router#

    I have seen sections used as shown here in various CCNP classes, but I like using the parameter section, notrouter eigrp, and limiting mysel to seeing the EIGRP parameters like AS # and network commands (thingsunder router confguration mode) but instead use the ollowing..

    Router#show run | section eigrp

    ip summary-address eigrp 100 10.0.0.0 255.255.255.0 5

    routereigrp 100

    network 1.0.0.0

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    5/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 5

    network 2.0.0.0

    auto-summary

    Router#

    By just putting the word eigrp, I can see other EIGRP -related things confgured. In this example, I add ad-

    ditional parameters, like summarization. Other examples could be i you have some EIGRP related SNMP trapsyou have confgured they will also show up.

    Include and ExcludeThe other parameter I can use is the include parameter. Using the include parameter, I can restrict the lines toones that include the words ip address. Lets see the output.

    Router#show run | include ip address

    ip address 1.1.1.1 255.255.255.0

    ip address 2.2.2.1 255.255.255.0Router#

    Another useul parameter is exclude, which, as you might expect, will do the opposite oinclude. This willshow me every line except or the lines that contain the words ip address.

    Router#show run | exclude ip address

    Building conguration...

    Current conguration : 870 bytes

    version 12.4

    service timestamps debug datetimemsec

    service timestamps log datetimemsecno service password-encryption

    hostname Router

    boot-start-marker

    boot-end-marker

    noaaa new-model

    memory-sizeiomem 5

    ipcef

    no ip domain lookup

    ipauth-proxy max-nodata-conns 3

    ip admission max-nodata-conns 3

    interface FastEthernet0/0

    ip summary-address eigrp 100 10.0.0.0 255.255.255.0 5

    duplex auto

    speed auto

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    6/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 6

    interface FastEthernet0/1

    duplex auto

    speed auto

    routereigrp 100

    network 1.0.0.0

    network 2.0.0.0auto-summary

    ip forward-protocol nd

    ip http server

    no ip http secure-server

    control-plane

    line con 0

    password cisco

    login

    line aux 0

    no exec

    linevty 0 4

    password cisco

    login

    end

    Router#

    Oten I hear students say that their IOS might or might not support the little shortcuts we mentioned here, butthat might not be entirely true. Have you ever noticed that when you do the show run command (and youhave not changed the norms), then your system will show you the frst page o output ollowed by More. You

    can move through the commands and pages by doing the ollowing.

    Spacebartomoveonepageatatime,

    EnterKey(carriagereturn)tomoveonelineatatime or

    Qtoquitoutoftheoutput.

    But, you can also type other parameters to fnd the one you need.

    /doestheequivalentofbegin

    +doestheequivalentofinclude

    -doestheequivalentofexclude

    Show ip int brieThe other commonly used command in the Cisco world is show ip int brie. This gives the Layer 1, Layer 2,and Layer 3 inormation without all the other gory details. The problem is: What happens i I have too manyinteraces, or i I just want to look at a specifc interace?

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    7/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 7

    Router#show ip int brief | inc FastEthernet0/0

    FastEthernet0/0 1.1.1.1 YES manual upup

    Router#

    Or, maybe I am confguring IP addresses on my interaces, but I have been working on too many and, ater along hard day, I cant remember which interaces Im done with and which I have let.

    Router#show ip int brief | inc unassigned

    FastEthernet0/1 unassigned YES manual upup

    Router#

    Case SensitivityHave you noticed that I have been very specifc about the case sensitivity o the parameter Im putting in thesecommands? For example, in the word FastEthernet the F and E are uppercase because this is how the systemshows it. In the last example, I was looking or unassigned in all lowercase. What i I dont know i it shouldbe uppercase or lowercase?

    Router#show ip int brief | inc UNASSIGNED

    Router#

    Router#show ip int brief | inc (UNASSIGNED|unassigned)

    FastEthernet0/1 unassigned YES manual upup

    Router#

    As you can see that there was no output when I had the word UNASSIGNED (all uppercase) but when I put inthe OR operation looking or UNASSIGNED OR unassigned it gave me the output I was looking or.

    Show ip bgpI you have been using regular expressions, you might already be amiliar with these operations. You can usemore regular expressions currently in the BGP world. For example, instead o doing show command to see thehundreds o thousands o routes, I can maybe do the ollowing.

    Show ip bgpregexp _80$

    route-server>show ip bgpregexp _80$BGP table version is 84415369, local router ID is 12.0.1.28

    Status codes: s suppressed, d damped, h history, * valid, > best,i - internal,

    r RIB-failure, S Stale

    Origin codes: i - IGP, e - EGP, ? - incomplete

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    8/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 8

    Network Next Hop Metric LocPrf Weight Path

    * 3.0.0.0 12.123.29.249 0 70182828 6181 80 i

    * 12.123.13.241 0 70183356 6181 80 i

    * 12.123.37.250 0 70183356 6181 80 i

    *> 12.123.1.236 0 70183356 6181 80 i

    * 12.123.145.124 0 70182828 6181 80 i

    * 12.123.33.249 0 70182828 6181 80 i

    * 12.123.142.124 0 70182828 6181 80 i

    * 12.123.21.243 0 70182828 6181 80 i

    * 12.123.134.124 0 70183356 6181 80 i

    * 12.123.17.244 0 70183356 6181 80 i

    * 12.123.41.250 0 70183356 6181 80 i

    * 12.123.137.124 0 70183356 6181 80 i

    * 12.123.5.240 0 70183356 6181 80 i

    * 12.123.45.252 0 70183356 6181 80 i

    * 12.123.25.245 0 70183356 6181 80 i

    * 12.123.139.124 0 70183356 6181 80 i

    As you can see, I am keying in on the AS_Path attribute in the output o the show ipbgp command and amable to see ONLY the prefxes that originated in AS 80 indicated by the Number 80 in the extreme right side othe AS_Path attribute.

    DO CommandAs you can see, I have been typing the commands like Show running-confg and show ip interace brieat the privilege exec mode (Router#). What i I am in the middle o my confgurations and have made changesto numerous interaces, and then I want to do one o these commands? Well, you can do that without exiting

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    9/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 9

    out completely by using the DO command. DO command will let you do the things that you were previously notable to do here in these modes. For example:

    Router#

    Router#show ip int brief

    Interface IP-Address OK? Method Status

    ProtocolFastEthernet0/0 1.1.1.1 YES manual upup

    FastEthernet0/1 unassigned YES manual upup

    Router#conf t

    Enter conguration commands, one per line. End with CNTL/Z.

    Router(cong)#interface fa 0/0

    Router(cong-if)#show ip int brief

    ^

    % Invalid input detected at ^ marker.

    Router(cong-if)#do show ip int brief

    Interface IP-Address OK? Method StatusProtocol

    FastEthernet0/0 1.1.1.1 YES manual upup

    FastEthernet0/1 unassigned YES manual upup

    Router(cong-if)#

    So, this works out fne when we put in the word DO beore the command. But, even though DO is letting youperorm these commands here, you have to know the syntax o the command. Help wont work here becauseits not where the command really belongs; likewise, the autocomplete unction using the TAB key is unavailableas well.

    AliasesAnother shortcut that can make your lie easier is the creation o aliases. Consider the command show ipinterace brie. Even though we know how to type, that is a lot o typing. And i you start using commands withparametersandsubparameters,itcouldquicklybecometoomuchtypingifyouaredoingiteveryday,allday.

    You can create aliases that can be used at dierent modes. I have created two in my example.

    1. test which upon typing in Privilege Exec mode will run the show ip int brie command

    2. test2 which upon typing in the interace confguration mode will run the show ip int brie command

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    10/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 10

    O course, in a real environment, I would use something like siib as an alias or show ip int brie instead otest. Let me show you the commands to create the alias and the use o those aliases.

    Router#

    Router#conf t

    Enter conguration commands, one per line. End with CNTL/Z.

    Router(cong)#alias exec test show ip int brief

    Router(cong)#alias interface test2 do show ip int brief

    Router(cong)#

    Router(cong)#end

    Router#

    *Mar 1 01:29:03.835: %SYS-5-CONFIG_I: Congured from console byconsole

    Router#test

    Interface IP-Address OK? Method StatusProtocol

    FastEthernet0/0 1.1.1.1 YES manual upup

    FastEthernet0/1 unassigned YES manual upup

    Router#conf t

    Enter conguration commands, one per line. End with CNTL/Z.

    Router(cong)#int fa 0/1

    Router(cong-if)#test2

    Interface IP-Address OK? Method StatusProtocol

    FastEthernet0/0 1.1.1.1 YES manual upup

    FastEthernet0/1 unassigned YES manual upup

    Router(cong-if)#endRouter#show aliases

    Exec mode aliases:

    h help

    lo logout

    p ping

    r resume

    s show

    uundebug

    unundebug

    w where

    test show ip int brief

    Interface conguration mode aliases:

    test2 do show ip int brief

    Router#

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    11/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 11

    DeaultsMany times in your environment you might have interaces that were once used or a Purpose A but now haveto be reassigned to Purpose B. You need to remove the older parameters rom them in order to enter the newinormation.

    Yes, you could simply say NO to each parameter and the new confguration variables or this new purpose, butwhat i there were ten or fty things keyed in on the interace? I hope you are not planning on saying NO tofty commands My avorite solution is the use o the deault command. Let me show you an example.

    Router#show run interface fa 0/0

    Building conguration...

    Current conguration : 181 bytes

    interface FastEthernet0/0

    description Test Link

    ip address 1.1.1.1 255.255.255.0

    ip summary-address eigrp 100 10.0.0.0 255.255.255.0 5

    speed 10half-duplex

    keepalive 5

    end

    Router#

    Now, check this out.

    Router#conf t

    Enter conguration commands, one per line. End with CNTL/Z.

    Router(cong)#default interface fa 0/0

    Building conguration...

    Interface FastEthernet0/0 set to default conguration

    Router(cong)#do show run int fa 0/0

    Building conguration.

    Current conguration : 73 bytes

    interface FastEthernet0/0

    no ip address

    duplex auto

    speed auto

    end

    Router(cong)#

    As you can see, this interace has been set to a actory deault confguration. You can also use this parameteron switches that support the interace range parameter and set several interaceseven across dierent linecardsto their actory deaults.

  • 7/30/2019 WP CI CiscoIOSCommandShortcuts

    12/12

    Copyright 2010 Global Knowledge Training LLC. All rights reserved. 12

    So, now that we know a couple o these tricks/shortcuts, how many o them can we use in the real exam simu-lations? Well, unortunately these will only help you in an exam where you have access to real routers whichat the moment is just the CCIE lab exam. The associate and proessional level exams are simulations, not realrouters. In the simulations you can only do what it was programmed to do.

    In these exams you can abbreviate the commands, meaning you can type shoipint brie rather than spell outthe words in the commands. You can also press the TAB key to autocomplete, and you can type ? in the com-mands to see what parameters are allowed. But the last I checked using an alias is not an allowed option, nor isthe DO command.

    SummaryI hope these little tricks and tips help you manage your environment. For more inormation on technologies cov-ered in this white paper and to understand the outputs used in these scenarios, consider taking the CCNP trackthroughGlobalKnowledge.

    Learn MoreLearn more about how you can improve productivity, enhance efciency, and sharpen your competitive edge.CheckoutthefollowingGlobalKnowledgecourse(s):

    Route Implementing Cisco IP Routing v1.0

    Switch Implementing Cisco IP Switched Networks v1.0

    CCNA-TS Troubleshooting Cisco Internetworks or Network Associates

    For more inormation or to register, visit www.globalknowledge.com or call 1-800-COURSES to speak with asales representative.

    Our courses and enhanced, hands-on labs and exercises oer practical skills and tips that you can immediatelyput to use. Our expert instructors draw upon their experiences to help you understand key concepts and how toapply them to your specifc work situation. Choose rom our more than 1,200 courses, delivered through Class-rooms, e-Learning, and On-site sessions, to meet your IT and business training needs.

    About the AuthorDheeraj(Raj)TolanihasbeenworkingwithGlobalKnowledgeasacontractinstructorteachingvariousnetwork-ing courses including CCNA, CCDA, CCNP, CCDP, CCIP, CCVP tracks. He has been in the industry or over 17 yearsworking with various technologies and multiple vendors including Cisco, Banyan Vines, Microsot, Comptia and

    Novell. Dheeraj has worked as a consultant or various medical, fnancial, legal, government, and publishingcompanies. He runs a consulting company based out o New York City, which provides IP integration solutions.You can visit his web site at www.rajtolani.com