讓一隻大貓咪在打字機上隨機地按鍵,當按鍵時間達到無窮時,幾乎必然能夠打出任何給定的文字,比如你看到的這個網誌。

在 Debian 下設定 Serial over LAN

其實在 Linux 上設定 serial port 本來是一個很簡單直覺的事情,不管用什麼 distro 看看 Arch Wiki 總是沒錯的。但是古早硬體的 Serial over LAN 就沒那麼好理解了。

使用的環境:

  • Supermicro X10 motherboards
    • Firmware Revision : 01.94
    • Firmware Build Time : 08/05/2015
    • BIOS Version : 3.0
  • Debian GNU/Linux 13 (Proxmox VE 9)

BIOS 設定

Serial over LAN 需要先在 BIOS 中設定。
Supermicro 的新版本 BIOS 中,SOL/COM2 Console Redirection 是統一的設定項。但是在老版本中,兩者是獨立的設定項。在老版本中,無需要理會 COM2,只需要設定 SOL Console Redirection 就可以了。

設定成大概這樣:

                 Aptio Setup Utility - Copyright (C) 2012 American Megatrends, Inc.
          Advanced
/-----------------------------------------------------------------------+--------------------------\
|                                                                       |Console Redirection       |
|  COM1                                                                 |Enable or Disable.        |
|  COM1 Console Redirection                     [Disabled]              |                          |
|> Console Redirection Settings                                         |                          |
|                                                                       |                          |
|  COM2                                                                 |                          |
|  COM2 Console Redirection                     [Disabled]              |                          |
|> Console Redirection Settings                                         |                          |
|                                                                       |                          |
|  SOL                                                                  |                          |
|  SOL Console Redirection                      [Enabled]               |                          |
|> Console Redirection Settings                                         |                          |
|                                                                       |--------------------------|
|  Serial Port for Out-of-Band Management/                              |><: Select Screen         |
|  Windows Emergency Management Services (EMS)                          |^v: Select Item           |
|  EMS Console Redirection                      [Disabled]              |Enter: Select             |
|> Console Redirection Settings                                         |+/-: Change Opt.          |
|                                                                       |F1: General Help          |
|                                                                       |F2: Previous Values       |
|                                                                       |F3: Optimized Defaults    |
|                                                                       |F4: Save & Exit           |
|                                                                       |ESC: Exit                 |
|                                                                       |                          |
|                                                                       |                          |
|                                                                       |                          |
|                                                                       |                          |
\-----------------------------------------------------------------------+--------------------------/
                  Version 2.15.1236. Copyright (C) 2012 American Megatrends, Inc.

Linux 設定

一般來說,Serial-over-LAN 會使用 COM2。但這邊實際使用的是 COM3,在 Linux 內對應的裝置是 ttyS2。

需要修改 GRUB 的設定,讓 GRUB 使用 serial,並且告訴 kernel 增加多個 console。
增加一個設定檔案在 /etc/default/grub.d/serial.cfg:

GRUB_TERMINAL="console serial"
GRUB_LINUX_CMDLINE="$GRUB_LINUX_CMDLINE console=ttyS2,115200n8"

如果不確定,可以先讓 kernel 同時使用多個 console,並且測試:

#!/usr/bin/env bash
for d in /dev/ttyS{0..3}; do
  [ -e "$d" ] || continue
  stty -F "$d" 115200 cs8 -cstopb -parenb -ixon -ixoff -crtscts
  echo "TEST: $d" > "$d"
done

使用 Serial over LAN

透過 ipmitool:

ipmitool -I lanplus -H $BMC_IP -U $BMC_USERNAME -P $BMC_PASSWORD sol info
ipmitool -I lanplus -H $BMC_IP -U $BMC_USERNAME -P $BMC_PASSWORD sol activate

透過 SSH:

ATEN SMASH-CLP System Management Shell, version 1.05
Copyright (c) 2008-2009 by ATEN International CO., Ltd.
All Rights Reserved

-> start system1/sol1

添加新评论