Chuck Carroll


Configure a Cisco Switch or Router from Linux

Published: 2024-10-09

First you need a console cable, otherwise known as a rollover cable. From what I've seen, these cables generally have an RJ45 connector on one end and a DB9 serial connector on the other. I don't have any DB9 serial connects on my laptop and I'd have to get an RS-232 to USB adapter anyways, so I just picked one up that already had USB. I picked mine up from eBay for about $8.

USB to RJ45 Console Cable
USB to RJ45 Console Cable

There's a couple of ways to make a connection. In my courses, everyone seems to be using PuTTy. To my surprise, PuTTy is also available on Linux - I found it in the Arch User Repository. However, I'm already comfortable in a Linux terminal and quickly learned that consoling into a Cisco switch or router can be done simply by using GNU Screen.

GNU Screen, for those unfamiliar, is a terminal multiplexer that allows you to manage multiple terminal sessions in a single window, allowing you to run multiple shell sessions simultaneously. GNU Screen should be available in just about any Linux distro's default repository.

Identify the serial device by running ls /dev/tty*. This will list all devices starting with "tty". Because I'm using a USB cable, my device showed up as "ttyUSB0", but other serial ports show up as "ttyS0".

To establish a connection with your Cisco router or switch, run the command sudo screen /dev/ttyUSB0 9600. Replace "ttyUSB0" with your device and "9600" as the default baud rate (9600 is the default for most Cisco devices).

There is no difference managing Cisco equipment from a terminal window vs. using PuTTy. PuTTy has a nice little GUI with checkboxes, radial buttons, and customization options to configure the PuTTy terminal, but anyone with just a little bit of IT experience should be able to console in or SSH into a Cisco networking equipment with a single command.

One thing I'll close with is I experienced jumbled text in my terminal. I've determined that this was due to switching back and forth between PuTTy and establishing a connection via my terminal, and that restarting my machine solved the issue.

Thanks for reading. Feel free to send comments, questions, or recommendations to hey@chuck.is.