My lab will require me to console into 4 switches. I don’t want to buy another router to be my terminal server, and I also don’t want to have to swap out console cables every 2 minutes.
Thankfully I don’t have to. Linux has a handy tool to turn a regular PC with a bunch of USB serial ports into a terminal server.
All you need is a bunch of USB ports (a USB hub will do), some rollover cables and a bunch of these which I found on ebay:
I bought 3 of the above, as the PC itself already has 1 serial port.
The app I’m going to use is called ser2net. Let’s install it
[email protected]:~$ sudo apt-get install ser2net
Now let’s see if Ubuntu 10.10 has reconised my USB serial cables:
[email protected]:~$ dmesg | grep tty [ 0.000000] console [tty0] enabled [ 0.932016] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 0.932314] 00:05: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A [ 6.625434] usb 6-1: ch341-uart converter now attached to ttyUSB0 [ 6.649441] usb 6-3: ch341-uart converter now attached to ttyUSB1 [ 6.672443] usb 3-2: ch341-uart converter now attached to ttyUSB2
Looks good so far. ttyS0 is my physical serial port and the ttyUSBx ports are the 3 USB-Serial cables. I’ll now configure ser2net to map TCP ports to my onboard port and my 3 USB ports.
[email protected]:~$ sudo vi /etc/ser2net.conf
At the bottom of that file you’ll see this:
2000:telnet:600:/dev/ttyS0:9600 8DATABITS NONE 1STOPBIT banner 2001:telnet:600:/dev/ttyS1:9600 8DATABITS NONE 1STOPBIT banner 3000:telnet:600:/dev/ttyS0:19200 8DATABITS NONE 1STOPBIT banner 3001:telnet:600:/dev/ttyS1:19200 8DATABITS NONE 1STOPBIT banner
Let’s change it to this:
2000:telnet:600:/dev/ttyS0:9600 8DATABITS NONE 1STOPBIT banner 2001:telnet:600:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner 2002:telnet:600:/dev/ttyUSB1:9600 8DATABITS NONE 1STOPBIT banner 2003:telnet:600:/dev/ttyUSB2:9600 8DATABITS NONE 1STOPBIT banner
save and quit, then restart ser2net:
[email protected]:~$ sudo /etc/init.d/ser2net restart * Restarting Serial port to network proxy ser2net [ OK ]
Now to test!
My dynamips box has an IP of 10.20.30.11. If I want to get to the physical serial port from my laptop, I only need to do this:
C:\Users\Darren>telnet 10.20.30.11 2000 ser2net port 2000 device /dev/ttyS0 [9600 N81] (Debian GNU/Linux) C3560# C3560#
What about a USB cable?
C:\Users\Darren>telnet 10.20.30.11 2003 ser2net port 2003 device /dev/ttyUSB2 [9600 N81] (Debian GNU/Linux) C3550# C3550#
I use a tabbed telnet/SSH app called ZOC. From there I can specify the telnet ports and which switch they map to. I can now console into all of them without the need of a terminal server. The actual USB-Serial cables only cost me £2 each, and you can have loads of them.
(2011/02/19) EDIT: Dariush below mentioned that you can get multiple serial adaptors through a single USB port. This is an example: http://www.amazon.co.uk/NEWLink-Serial-Quad-Cable-Adaptor/dp/B003DA5TG4
If you don’t want to go the USB hub root, this could certainly work. Serial cables aren’t exactly high bandwidth. I’ve even found an 8 port model here, but no price: http://www.delock.com/produkte/gruppen/USB+Adapter/Delock_Adapter_USB_8x_Serial_61519.html