Cisco

Cisco IOS – getting out of trouble

As simple as this tip is, you will be amazed on how often it is overlooked during remote night maintenance work. I have therefore decided for that reason to post it here.

So, you are sitting at home, editing an IOS configuration of X router during a maintenance window. Your only available remote login is through the wan interface. A bad access list and you can be locked out of the router till you physically go to the office to undo the changes.

It is late and you don’t fancy driving!

Here is a small tip which could save you the hassle

Prior to editing

edge1#reload in 10

Reload scheduled in 10 minutes

Proceed with reload? [confirm]y

Now as you guessed, you just issued the router  to reboot in 10 minutes

Now start editing…

When done, if all is good and all is working as expected, you can then proceed to cancel the scheduled reboot

edge1#reload cancel

The scheduled reboot is now cleared… if you happened to lock yourself out of the router, within the 10mn lapse time from the moment you issued the reload command, the router would reboot with the startup-config and give you access back to your router (assuming of course you didn’t save your running-config changes).

I hope that was informative!

Cisco IOS Tips – cache running-configuration

This is probably one of the most ignored and forgotten feature of IOS since 12.2(25)S and 12.2(27)SBC.

I am positing it  here as I never stopped coming across routers and switches with this feature not active. Please note you need to enough memory,to use this feature; that is to say, the available space in memory to hold a copy of the interfaces configuration.

As you may guess, a router or switch with a monstrous configuration, can take a while to display the running configuration when issuing

edge1#sh run

as it needs to fetch all the configuration from various places in memory.

Quoting Cisco

When invoked, NVGEN queries each system component and each instance of interface or other configuration objects. A running configuration file is constructed as NVGEN traverses the system performing these queries.

To speed things up, IOS ships in with a feature called Configuration Generation Performance Enhancement , which caches the interfaces configurations, which in return speed up NVGEN.

Activate caching with

edge1(config)#parser config cache interface

and voilà.

Cisco IOS Configuration boot register – ROMMON

Every cisco routers has a configuration register which is saved in NVRAM and is a 16 bit value.

This post will not tackle all the 16 bits of the configuration register, but only the 13th bit which is used to either load IOS or ROMMON. Another post will be made to detail all the 16 bit configuration register.

Before continuing, it is important to understand the basic “boot process” of a router. When you power a router on, it first performs a POST, then loads the bootstrap program from ROM to RAM, which in return loads the appropriate IOS (bootstrap can load an IOS from tftp)/ROMMON or RXBOOT. Once loaded, the bootstrap program gives the hand to the IOS to handle the commands from there on.

The most important bit is the low order bit which is (2 for IOS, 1 for Rxboot and 0 for ROMMON)

Please note that by default, the low order boot bit is 2 thus 0x 2102

Example:

home-booth(config)#conf t
home-booth(config)#config-register 0×2100
home-booth(config)#do wr
Building configuration…
[OK]
home-booth(config)#do reload

Proceed with reload? [confirm]

(… a bit later)

%SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload Command.
System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)
Cisco 1841 (revision 5.0) with 114688K/16384K bytes of memory.

rommon 1 > System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)
Cisco 1841 (revision 5.0) with 114688K/16384K bytes of memory.

rommon 1 >
rommon 1 > confreg 0×2102
rommon 2 >

What could ROMMON be useful for? Simple… restoring a router with a corrupted/broken IOS image!

Configuration Register

Cisco IOS shortcuts

Configuring Cisco IOS shortcuts command are quite easy and neat… just use the exec command “alias”.

command structure: alias <mode> <shortcut> <command>

Example in exec mode: sh ip int br (show ip interface brief)

so following, we would get “alias exec s sh ip int br”

Example in configure mode: router ospf

and we would get “alias configure ro router ospf”

More mixed examples [ alias / original command / command to enter ]

shr / show run | inc ip  / alias exec shr sh run | inc ip

et0 / interface fa0/0 / alias configure et0 interface fa0/0

reload /  sh run / alias exec reload sh run <— rewrite IOS command

I hope that was informative!

Cisco IOS hidden tools

Hello there,

Just a quick overview over a couple of cisco hidden command useful in certain circumstances

1. ttcp

ttcp is only available on routers/layer 3 switches (of course ;-) )

For those familiar with iperf, ttcp is a kinda”ish” iperf

Start ttcp on one router in point 2 point scenario and ttcp on the other endpoint. One router will be in receiving mode, while the other will be in sending mode… running the command is quite straight forward, thus I will not demonstrate it here.

2. test crash

Ok this used to be hidden, but isn’t in newer IOS version. Test crash allows to simulate a crash.. so you came to the office one morning and found your switch dead… not log, not knowing what happened. test crash can help you dig into the problem by simulating the crash

3. test transmit

This is a very cool feature :-D (ah I love cisco :) ). You can simulate traffic to interfaces, using specific encapsulations and protocols…

4. ip route profile and show ip route profile

Used in conjonction, this “debug” command enables you to see route fluctuation.

5. csim start “number”

This emulates a voice call to the specified number… practical for VoIP testing environment.

6. show controller switch

Need to get a quick overview on your switch traffic stats. Suspect a congestion network? show controller switch will give you the quick heads up on where you stand

7. debug ip osfp monitor

This command enables you to monitor the OSPF SPF process

8. ip-con 2 con

Available on cisco 7500… it enables you to enter the VIP console to execute VIP commands on VIP boards

9.  ip osfp interface retry <X>

Back to OSPF :) (the coolest routing protocol), by default OSPF pools retry on the interface 10 times… having too much fluctuation of states on the interface of your router? increase the pooling period.

10. show region

Displays how the memory is partitioned on the device