The other day at work I had to set up a console connection between two linux servers via a null modem cable connected to their serial ports. We have some servers that are regularly rebooting themselves, and we have been unable to capture any data from the console until now.
First, connect your servers together using a null modem cable connected to the serial ports.
Next, on the source server you want to run the console from, modify the /boot/grub/grub.conf such that the kernel gets passed the following parameters at boot time: console=ttyS0,9600n8
This configures a console session on the first serial device, with a baud rate of 9600, one start bit, eight data bits, no parity, one stop bit, and no CTS/RTS flow control.
Here’s an example of a complete section of a working grub boot loader:
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.ELsmp ro root=/dev/rootvg/rootvol rhgb quiet console=ttyS0,9600n8
initrd /initrd-2.6.9-42.ELsmp.img
Add the following line to the /etc/inittab file on the server the console session is running on, making sure the co identifier is not used anywhere else in the file:
# Console connection
co:2345:respawn:/sbin/mingetty ttyS0 CON9600 vt102
Finally reboot the source server.
Once the server is back up, on the second ‘display’ server, open a terminal session and run a piece of software called minicom.
When minicom is running press CTRL-A to open the menu. Press Z to display the help screen. Press O to cOnfigure minicom. Use the arrows to select ‘Serial port setup’ and press enter. Press A to configure the serial device and change it from ttyS1 to ttyS0. Press E to configure the baud rate, and press E again to select 9600. Press enter twice to exit, move down to ‘Save setup as dfl’ and press enter. Move down to ‘Exit’ and press enter.
If needs be, exit minicom (CTRL-A, x) and restart it. Your console connection should now work.
By default, you wont be able to log into this console directly as root. To enable you to do so, edit /etc/securetty and add the new console device to the list (ttyS0). Changes to this file take effect immediately. No need to reboot or restart anything.