How do I setup multiple minicom / Cisco console server sessions without too much hassle?
I'm working on my CCNA and have 4 switches & 4 routers which make up my main lab. I bought two quad port USB to Serial (1 USB to 4 Serial) Adapters onto the ends of which I've attached 8 Serial rollover cables.
Those USBs are plugged into a P4 Ubuntu server and I can successfully ssh into that server and manage any of the devices using minicom, as myself as I'm in the dialout group.
I have a minicom save file for USB[0-7] and have used ln to link SW1-4, R1-4 so I can "minicom R1", etc.
With my dual monitors, I can have all 8 terminal sessions open - 4 on each screen.
Here's the main thing though: I have to open a terminal on my workstation, SSH across to the access server, then run minicom. I have to do this once for each device. Although that's not a back breaker, I'm sure there must be a simpler way to do it - can I tell my server to expose each serial connection as a telnet or ssh port? I would really like to be able to run a script of some sort that launched all eight sessions in one click.
Some time ago I was able to make this kind of serial to network redirection using remserial:
Give access to a RS232 device over a network.
The computer with the serial port connected to the device (such as a data aquisition device) runs the remserial program:
remserial -d -p 23000 -s "9600 raw" /dev/ttyS0 &
This starts the program in daemon mode so that it runs in the background, it waits for connections on port 23000 and sets up the serial port /dev/ttyS0 at 9600 baud. Network connections to port 23000 from any machine can then read and write to the device attached to the serial port.
This can be started from /etc/rc.local or as an entry in /etc/inittab or set up as a system service with a file in /etc/rc.init/.
This is what you need:
Server farm console control.
Assuming multiple Linux servers (such as web servers) are set up to have a serial port as their console instead of a monitor/keyboard, their serial ports could be connected to a control server using a multi-port serial board. On the control server, a copy of remserial is run for each server:
remserial -d -p 23000 -s "115200 raw" /dev/ttyS0 remserial -d -p 23001 -s "115200 raw" /dev/ttyS1 remserial -d -p 23002 -s "115200 raw" /dev/ttyS2 remserial -d -p 23003 -s "115200 raw" /dev/ttyS3
From any computer on the local network, use a telnet program to connect to the control server on the appropriate port:
telnet control-server-name 23002
This would connect through the associated serial port to the desired server's console. This example would then give the user console access to the 3rd server.
Careful scripting such as using the Linux "expect" program could allow batches of commands to be run on each server.
At the end of the page you'll find links to download a precompiled binary for i386 (32-bit) and the source code (if you're running a 64-bit OS or prefer to compile it yourself).
EDIT: To add a little automation you can install expect
and write the following script:
#!/usr/bin/expect
spawn telnet 192.168.0.1
expect "Username:"
send "your-username\r"
expect "Password:"
send "your-password\r"
expect "#" <----- prompt character ($ or #)
interact
This will automatically telnet to the host login and drop you to the prompt.