Linux host management via serial port can solve hardware shortage

Source: Internet
Author: User
Article Title: Linux host management through serial ports can solve the hardware shortage. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In some cases, two or more Linux Hosts must be managed and operated simultaneously. If you lack enough keyboards and monitors, It is a quick and effective way to control other hosts through the serial port of one machine.
  
The following uses two hosts as an example to briefly introduce the configuration method. Assume that the two hosts are A and B, both of which run Red Hat 9.0.
  
   Host A configuration
  
Host A should select an appropriate serial communication tool. In this article, we will use the Linux built-in Minicom.
  
Log On As root and run the following command:
  
# Minicom-s
  
The main configuration menu of Minicom is displayed. Move the arrow key of the keyboard and select the menu item "Serial Port Setup". The following configuration items are displayed:
  
A-Serial Device:/dev/ttyS0
B-Lockfile Location:/var/lock
C-Callin Program:
D-Callout Program:
E-Bps/Par/Bits: 9600 8N1
F-Hardware Flow Control: No
G-Software Flow Control: No
Change which setting?
  
Configure the following parameters as needed:
  
◆ Serial port device/dev/ttyS0;
  
◆ Baud rate: 9600;
  
◆ Frame format: 8N1 (indicating that there are 8-bit data, 0-bit checksum and 1-bit Stop bits );
  
◆ No software or hardware throttling.
  
Note that the serial port device number can be changed according to the connected port. For example, if you connect to the COM2 port, set it to/dev/ttyS1. The baud rate must be set to the same as that of host B.
  
After the configuration is complete, return to the main configuration menu and select the "Modem and Dialing" menu item, clear the values of the "A-Init string", "B-Reset string", and "K-Hang-up string" options. Then return to the main menu, select the "Save As Dfl" menu item, and Save it As the default setting. After "Exit from Minicom" is selected, run the following command to restart Minicom:
  
# Minicom
  
   Host B Configuration
  
Host B needs to modify the following files.
  
1. Modify the/etc/inittab File
  
This is the configuration file of the init program, used to set the default status and terminal connection. Add the following line to the file to initialize the serial port terminal:
  
Tty: 2345: respawn:/sbin/agetty ttyS0 9600 vt100
  
"Tty" indicates the ID of the row. "2345" indicates that the row runs at levels 2, 3, 4, and 5. "respawn" indicates that the command is executed again after exiting, so that other users can log on. "/sbin/agetty ttyS0 9600 vt100" indicates the specific command. This command opens the serial port/dev/ttyS0 (COM1) through the/sbin/agetty program ), the baud rate is set to 9600bps, and the terminal mode is vt100.
  
After host B is restarted, the logon page of host B is displayed on host. However, there are two problems at this time: one is that you cannot log on to B as the root user on host A; the other is that the prompts related to the startup and shutdown processes of host B cannot be displayed on host. The latter is because the information during Linux Startup is displayed by the kernel and is output to the main console (tty1) by default ). To solve these two problems, you also need to modify the/etc/securetty file and the/etc/lilo. conf file.
  
2. Modify the/etc/securetty File
  
This file is a list of tty devices that are allowed to log on as root. These devices are read by the/bin/login program. To enable the user to log on as the root user through the serial port, you need to add "ttyS0" to the file to inform the system that COM1 is safe.
  
3. Modify the/etc/lilo. conf file
  
This document assumes that the system starts with LILO. To enable the startup information of LILO and kernel to be output to the serial port, you must modify/etc/lilo. conf file, add "serial = 0, 9600n8" after "linear ", replace "append =" root = LABEL =/"with" append = "root = LABEL =/console = ttyS0, 9600 "".
  
The serial option outputs the startup information of LILO to the serial port so that different systems or kernels can be selected for startup. "0" indicates that the serial port uses COM1; "9600" indicates that the baud rate is 9600bps; "n" indicates that there is no check bit; "8" indicates that there are 8 Data bit.
  
"Append =" root = LABEL =/console = ttyS0, 9600 "" is used to pass parameters to the kernel so that the system startup information is output to the serial port COM1 and the baud rate is set to 9600bps. After the modification is complete, run the LILO command again to make the configuration take effect.
  
So far, the keyboard, display, and other peripherals are connected to host A, and then host A connects to host B through the serial port to manage and control B. The required hardware is a serial port. Of course, both hosts are required to have a serial port.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.