CCIE R&S lab – How to console into your devices

Nowadays, most of the PC and other laptops don’t come with a serial port (also called DB9/RS232 or COM port) anymore. This may be a problem because a serial interface is what you need to connect a Cisco console cable between your host and a Cisco switch. One solution is to use USB serial adapters, the difficulty can be working out what chipset they use, especially if you want to use them on Mac OS X. A good alternative is to use a Terminal Server.

 

USB serial adapters

USB serial adapters are quite cheap, especially if you buy them on eBay; however be warned that they are usually shipped from China and it could take up to 2 or 3 weeks to receive your package. Another problem is to find the adapters with the chipset you want, most of the sellers won’t be able to tell and you will have to rely on their description saying what operating system are supported.

When buying a new USB serial adapter, it usually comes with a CD containing the right drivers for Windows. Therefore, it shouldn’t too hard to have your USB serial adapter working on Windows, but it could be less straightforward on other systems like Mac OS X. If not using Windows or if you don’t have any driver CD, the main information you will need is what chipset is used by your adapter, if you have access to Windows you can install the drivers and find out. Another way is the use Linux to identify the chipset, you can boot up a Ubuntu live cd if you don’t have Linux installed or don’t want to install it.

Identify the chipset in Linux

Common chipsets are:

You probably won’t have to install drivers on Linux as they usually come with it; this is why we use this system to detect chipsets. Once Linux is booted up, open a terminal and use the following commands to find the information you are looking for: dmesg and lsusb.

Example for a PL2303 based serial adapter:

Linux$ dmesg
[80.457599] pl2303 1-2:1.0: pl2303 converter detected
[80.491215] usb 1-2: pl2303 converter now attached to ttyUSB0
[80.491831] usbcore: registered new interface driver pl2303
[80.491834] pl2303: Prolific PL2303 USB to serial adaptor driver
Linux$ lsusb
Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

Example for a CH341 based serial adapter:

Linux$ dmesg
[4083.260123] usb 1-2: new full speed USB device number 5 using ohci_hcd
[4083.551191] USB Serial support registered for ch341-uart
[4083.551209] ch341 1-2:1.0: ch341-uart converter detected
[4083.589127] usb 1-2: ch341-uart converter now attached to ttyUSB0
[4083.589143] usbcore: registered new interface driver ch341
Linux$ lsusb
Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Example for a FTDI based serial adapter:

[6922.152913] ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
[6922.152944] usb 2-1: Detected FT232BM
[6922.154724] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0
[6922.154752] usbcore: registered new interface driver ftdi_sio
[6922.154755] ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver

Now that you know about the chipset, you can use that information to install the correct drivers. If the chipset is something different from what we listed, then remember Google is your friend.

USB serial adapters on Mac OS X

The recommended chipset on OSX is PL2303; this is the one used in our next example, open source drivers are even provided. Note that for our PL2303 based USB serial adapter to be detected on OSX Lion, I had to follow this solution.

After you have installed the driver, connect your cable to any of your free USB ports. Mac OS X will automatically create a serial device. Open up a terminal and find the entry that is referring to your cable(s) in /dev.

$ ls -l /dev/tty.*
 crw-rw-rw-  1 root  wheel   18,  34  4 Jan 21:47 /dev/tty.PL2303-001013FA
 crw-rw-rw-  1 root  wheel   18,  30  4 Jan 21:47 /dev/tty.PL2303-002013FA
 crw-rw-rw-  1 root  wheel   18,  32  4 Jan 21:47 /dev/tty.PL2303-003013FA
 crw-rw-rw-  1 root  wheel   18,  38  4 Jan 21:47 /dev/tty.PL2303-004113FA
 crw-rw-rw-  1 root  wheel   18,  36  4 Jan 21:47 /dev/tty.PL2303-004213FA

Here you can see that 5 adapters have been detected and installed. You can also find out about detected adapters in Apple’s system information window (About this Mac -> More Info … -> System report).

Connecting multiple adapters

In the last example for Mac OS X, you may have noticed we had 5 adapters, one for each connection to a switch. Even if this is possible to have 5 USB ports on a computer, here we used a USB hub. We did not have to plug the hub to a electrical outlet has our USB port provided enough power but we recommend you to get one with the option. Note that you can also find multiple serial adapters through a single USB port, which can be a solution too.

Now you can start connecting to a switch but first you will need a terminal software.

Terminal softwares

On Windows, HyperTerminal, Putty or SecureCRT are common terminal softwares. Plenty of tutorials exist on the Web about how to use them to get Console access to Cisco devices.

On Linux and Mac OS X, the fastest and easiest way is to use GNU screen, a command line program that is most of the time already installed on your system.

For instance with OSX, in a terminal window we simply type the following to get a console:

screen /dev/tty.PL2303-001013FA 9600

/dev/tty.PL2303-001013FA being our USB adapter (this will probably not be the same ID for you) and 9600 corresponding to the baud rate (9600 is the default for Cisco devices).

Use ^a,k to end the session and ^a,i to check the status of the serial port.

Minicom is another software for Linux and even Mac OS X.

Here are other terminal softwares for OSX:

These programs have graphical interfaces. The one that worked best for me is SecureCRT, unfortunately it is not free.

Terminal servers

The second way to console into your devices is to use a terminal server. The main advantage of a terminal server is that you can get console access to your hardware from a distance, using a network connection. It doesn’t matter if you are in the next room or in another country as long as you have connectivity to your terminal server. You have 3 options:

Here we will discuss the last option, which is usually the cheapest and most flexible.

The PC doesn’t need to be recent. How much CPU power and memory you need will depend if you intend to run IOS virtual routers, but if this is just for a terminal server, then a quite old PC with one or more USB ports will do great. Running Linux (here we are demonstrating for Debian/Ubuntu) on this computer is one of the best solution because Linux can run on old computer, it doesn’t require a GUI, has integrated drivers for many USB serial adapters and it is easy to set up the terminal server using a program called Ser2net.

Once your USB adapters are detected by Linux (check with dmesg), they are usually named ttyUSB0, ttyUSB1 etc. Next step is to install ser2net:

apt-get install ser2net.

Configuring Ser2net

Ser2net is a service that maps TCP ports to your USB ports. You need to make changes in its configuration file.

sudo nano /etc/ser2net.conf

The file should look like the following, for instance if you have 5 USB adapters:

2000:telnet:0:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner
2001:telnet:0:/dev/ttyUSB1:9600 8DATABITS NONE 1STOPBIT banner
2002:telnet:0:/dev/ttyUSB2:9600 8DATABITS NONE 1STOPBIT banner
2003:telnet:0:/dev/ttyUSB3:9600 8DATABITS NONE 1STOPBIT banner
2004:telnet:0:/dev/ttyUSB4:9600 8DATABITS NONE 1STOPBIT banner

The first number corresponds to the TCP port to reach respective switches linked by USB serial adapters.

Finally restart set2net.

sudo /etc/init.d/ser2net restart

Let’s suppose your terminal server has the 192.168.1.2 IP address, you should be able to connect to your Cisco device using telnet.

telnet 192.168.1.2 2000
ser2net port 2000 device /dev/ttyUSB0 [9600 N81] (Debian GNU/Linux)

SW1#

Missing IOS, password recovery and IOS upgrade

Maybe you bought your switches like me, on eBay. Your devices will most likely have be used in a network environment and may end up having configured password or even no IOS image at all. You will also want to upgrade the IOS image to the latest version. The best thing to do is to follow Cisco documentation for these cases.

What next?

You may also like these posts


Leave a comment

If you have a question, update, or comment about the article, please leave a comment. We try and respond to every comment, though it may take a few days, so please check back soon.

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>