Wednesday, May 8, 2013

Cisco IOS break sequence on Mac OS X using USB to serial adapter

I'm using a USB-to-serial adapter with a Prolific 2303 chipset on my Mac with Mountain Lion to reset a Cisco router.

open source Prolific 2303 USB driver
OEM Prolific 2303 USB driver

After you install either of the drivers on your Mac, it will show up as a device in '/dev/'. Search for it:
ls /dev/tty.*

Mine was '/dev/tty.usbserial'. Connect to that device using 'screen' with 9600 serial port speed:
screen /dev/tty.usbserial 9600

Your terminal should now be connected to the serial port.

Boot your Cisco router into ROMMON by power cycling it and then entering the break sequence before it starts to boot IOS - this is usually within the first 20 or 30 seconds of booting. Some newer Cisco routers don't display anything to the serial console until after this time window. So, enter the break sequence after you turn your router on and before IOS loads. Press it multiple times as soon as power is applied to the router to try to catch it at the right time. There are two good methods:

1. For the 'screen' program that comes with OS X: CTRL-A, CTRL-B
That is, CTRL-a followed by CTRL-b. Shift is not required. CTRL-A breaks the keyboard control out of what screen is showing you, allowing you to then enter a keyboard command that screen will process instead of sending it to your serial connection. CTRL-B is a screen command to send the serial break sequence to your serial connection.

2. Reconnect screen with a serial port speed of 1200, power on the router, then press and hold the space bar for 20-30 second (or up to a minute to be safe). screen's output will not be normal while connected at this speed, and this is normal. Reconnect screen with the correct speed (the default is 9600) and press enter - you should be looking at a Rommon 2> prompt.

If you made it into ROMMON, you can change the way that the router boots up with the 'confreg' command. Run it without arguments to get a question-answer style menu you can step through, or if you just want it to boot without reading the config file (factory reset):
confreg 2142

Power cycle the router again and you should be looking at the factory IOS bootup. When you get to the prompt, use 'enable', then 'configure terminal', then 'config-register 0x2102'. This will make the router boot normally, using the config file. You will need to 'write memory' if you want the new factory default config you have to be there when you reboot.

Terminal to Serial/USB Devices From a Mac
Cisco's Break Sequence List
Send break sequence on a Cisco reverse terminal server

No comments: