IP KVM Serial Console Switch

From Wiki

Jump to: navigation, search

Contents

Introduction to KVM over IP Serial Console

I recently setup a IP KVM Serial Console Switch which will allow get a Serial Console on some Linux Servers. There was a lot more involved in the setup than I originally thought. (Model: F1DP116SEA )

Advantages

Having a remote console is really useful, if not critical for remotely:

  • Dist-upgrading Servers
  • Rebooting Servers and Observing disk checks on reboot
  • Changing Bios Settings
  • Accessing Single User Mode and Booting from a Rescue CD
  • Access hung servers to see last console output (via kvm logs)
  • Fixing grub, boot and mdadm issues
  • Provide Remote assistance with onsite Admins

Disadvantages

  • Not suitable for GUI/X interfaces
  • Old servers will not allow access to the bios via the serial console (limits advantages above such as booting from Rescue CD)
  • New Servers have to be set to output/redirect to the serial console (to see the bios etc.)
  • Grub needs to be configured specially to output to the serial console (AFAIK - even on new dell servers)
  • Requires a working network connection
  • Connecting via Serial Console may not show the previous console output (e.g.: if a server hung), however the KVM console may keep a separate console log you can use.

Setup of IP KVM Serial Console Switch

This particular KVM switch gets an IP Address (either manually set, or via dhcp). To setup the IP KVM Serial Console, you either need a DHCP network to attach to, or a serial console on a client computer to connect to the KVM switch to manually assign a static IP.

Setup static IP on the KVM Switch

We couldn't in-fact get the dhcp to work, and had to setup a serial connection to the KVM using minicom.

  • Plugin serial cable from client computer to the KVM (into port labelled "Local Console")
  • apt-get install minicom
  • minicom -s
           +-----[configuration]------+
           | Filenames and paths      |
           | File transfer protocols  |
           | Serial port setup        |
           | Modem and dialing        |
           | Screen and keyboard      |
           | Save setup as dfl        |
           | Save setup as..          |
           | Exit                     |
           | Exit from Minicom        |
           +--------------------------+
#Choose Serial port setup. Choose ttyS0 for Serial Port 1. Choose E, 115200 8N1 and F, Hardware Flow Control Yes to match KVM Serial Console settings
   +-----------------------------------------------------------------------+
   | A -    Serial Device      : /dev/ttS0                                 |
   | B - Lockfile Location     : /var/lock                                 |
   | C -   Callin Program      :                                           |
   | D -  Callout Program      :                                           |
   | E -    Bps/Par/Bits       : 115200 8N1                                |
   | F - Hardware Flow Control : Yes                                       |
   | G - Software Flow Control : No                                        |
   |                                                                       |
   |    Change which setting?                                              |
   +-----------------------------------------------------------------------+
#After the above screen choose "Exit" on the main menu and this should connect via serial console.
       +--------------------------------------------------------------+
       |                 Belkin OmniView Serial Console               |
       |            Copyright (c) 2007, All Rights Reserved           |
       +--------------------------------------------------------------+
       |                             Log In                           |
       +--------------------------------------------------------------+

username :
Main                     Belkin OmniView Serial Console           Version: 1.0
================================================================================

[Network]   System    S-to-S

Current IP    IP Config    IP Filter


ENTER:select, TAB:next, '<':left, '>':right, 'q' or ESC:previous menu
Network                  Belkin OmniView Serial Console           Version: 1.0
================================================================================

Current IP   [IP Config]   IP Filter

IP Configuration

                       IP Mode                    [Static]
                       IP Address                 [193.1.99.121   ]
                       Subnet Mask                [255.255.255.192]
                       Default Gateway            [193.1.99.126   ]
                       Primary DNS                [193.1.99.120   ]
                       Secondary DNS (Optional)   [193.1.99.104   ]

Press: SPACE to select
TAB,ENTER:next field, '<':left, '>':right, 'q' or ESC:abort

Extra Options set in the KVM Switch

Once you have a static IP set from above, you can browse to the KVM Switch web gui on port 80, login as admin, admin and change the following settings.

  1. Serial Settings need to be changed for each of the 16 console ports. Make sure to set the Baud Rate to 115200
  2. Admin login needs to be changed. Default login is username: admin and password: admin
  3. Turn on console logging for each of the 16 console ports
  4. Change telnet to ssh for each of the 16 console ports

Setup of Server

On the server(s) you want to be able to console into, there are a few things which need to be set. On new Dell servers, you can enable output to the serial. On old servers you don't have this option, and as a result you can't access the bios. You can only access grub and the linux console.

Config of the Bios

See attached Pic.


Config of the Server

Grub2

vi /etc/default/grub
#add the following
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
GRUB_TERMINAL="serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

update-grub

Grub Legacy

vi /boot/grub/boot.ini
#at the top, add:
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
terminal --timeout=15 serial console

#change the kernel line from:
kernel          /vmlinuz-2.6.32-33-generic root=/dev/mapper/mainvg-root ro quiet splash 
#to:
kernel          /vmlinuz-2.6.32-33-generic root=/dev/mapper/mainvg-root ro quiet splash console=tty0 console=ttyS0,115200n8

#You can set the defaults in boot.ini incase you update the kernel in the future. Change:
# kopt=root=/dev/mapper/mainvg-root ro
to:
# kopt=root=/dev/mapper/mainvg-root ro console=tty0 console=ttyS0,115200n8

Save and Close.

Inittab and Getty

vi /etc/inittab
T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100

vi /etc/securetty
#make sure the following is in place.
ttyS0

Make sure that the --speed matches correctly to the speed of Console Port config in the KVM web gui

If you are on ubuntu, you probably don't have an inittab. Do the following: (make sure speed is set to 115200) See: https://help.ubuntu.com/community/SerialConsoleHowto

vi /etc/init/ttyS0.conf
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on stopped rc or RUNLEVEL=[2345]
stop on runlevel [!2345] 

respawn
exec /sbin/getty -L 115200 ttyS0 vt102

start ttyS0
stop ttyS0

vi /etc/event.d/ttyS0
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5

stop on runlevel 0
stop on runlevel 1
stop on runlevel 6

respawn
exec /sbin/getty 115200 ttyS0

If on ubuntu you only see the serial console, and no login prompt appears on the monitor, you need to do the following:

cp /etc/init/tty1.conf /etc/init/tty0.conf
/vi and change to tty0
cp /etc/event.d/tty1 to /etc/event.d/tty0
/vi and change to tty0

References

Personal tools