Posts Tagged ‘web’

5 Magic Cisco tips & tricks aka magic IOS commands

Monday, September 15th, 2008

I have been working a lot for several years, and now I want to share some of my best tips for working faster and more efficient on Cisco routers in Cisco IOS.

I posted earlier about the ‘do’ command, but I am going to include it here because it is so darn practical.

So with no further mess – here is the list, not sorted after any specific order.

  1. ‘do’ in config mode
    This is one of the most time saving ones that few people seem to know about, use it!
    It lets you run exec commands in global configuration mode.
  2. include, exclude and begin
    Ever wanted to find something in the configuration? Or maybe you want to see some info, and not some?
    Use include or exclude, for example you can do

    Router1(config)# do show running-config | include ip_address

    This will include every occurance of ‘ip address’ in your running configuration file, the underscore works for spaces, and as such you can also do

    Router1(config)# do show running-config | exclude password

    This will exclude every line that has the word ‘password’ in it, can be usefull if you are listing the configuration file to someone, or you can even do

    Router1(config)# do show running-config | exclude (password|secret)

    This will exclude every line containing EITHER password or secret, and you can use regular expressions here.
    This means that even show interfaces | include (^Vlan|Internet_address|packets\/sec) is valid, which will give you a list of your Vlan interfaces.

  3. alias ps
    Use aliases, do you ever run the same commands a thousand times?
    I have at least these aliases in place on all my equipment:

    alias exec sb show ip int brief
    alias exec ps sh proc cpu | excl 0.00%__0.00%__0.00%

  4. time-range command

    time-range Workhours
    periodic weekdays 8:00 to 16:00
    !
    ip access-list extended permit Permission-To-Internal-Server-In-Work-Hours
    permit tcp any host 10.0.0.5 eq www time-range Workhours
    deny tcp any host 10.0.0.5 eq www
    permit ip any any

    This will allow access to 10.0.0.5 within 8am and 4pm

  5. Redistribute default gateway route into OSPF
    A lot of people are wondering about this one too.

    Router1(config-rtr)# default-information originate always

    This is done under the ‘router ospf’ in global configuration.