[시스템] Serial Console 부팅 및 접속 설정 방법

1. 준비물

– FX 시리얼 케이블(널 모뎀 케이블)

2. 사전 확인

우선 OS에서 시리얼 포트를 인식하고 있는지를 확인한다.

[root@oscar root]# dmesg | grep tty

———————————————————————————————–

ttyS0 at 0x03f8 (irq = 4) is a 16550A

ttyS1 at 0x02f8 (irq = 3) is a 16550A

———————————————————————————————–

[root@oscar root]# setserial -g /dev/ttyS[01]

———————————————————————————————–

/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4

/dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3

———————————————————————————————–

만약 인식하지 않는다면 BIOS에서 해당 장치가 enable 되어있는지 확인한다.

3. 설정

[root@oscar root]# vi /etc/inittab

———————————————————————————————–

id:3:initdefault:

# System initialization.

si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0

l1:1:wait:/etc/rc.d/rc 1

l2:2:wait:/etc/rc.d/rc 2

l3:3:wait:/etc/rc.d/rc 3

l4:4:wait:/etc/rc.d/rc 4

l5:5:wait:/etc/rc.d/rc 5

l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

pf::powerfail:/sbin/shutdown -f -h +2 “Power Failure; System Shutting Down”

# If power was restored before the shutdown kicked in, cancel it.

pr:12345:powerokwait:/sbin/shutdown -c “Power Restored; Shutdown Cancelled”

# Run gettys in standard runlevels

1:2345:respawn:/sbin/mingetty tty1

2:2345:respawn:/sbin/mingetty tty2

3:2345:respawn:/sbin/mingetty tty3

4:2345:respawn:/sbin/mingetty tty4

5:2345:respawn:/sbin/mingetty tty5

6:2345:respawn:/sbin/mingetty tty6

# 아래의 두항의 해당 부분에 추가한다. ######################

# Run agetty on COM1/ttyS0 and COM2/ttyS1

s0:2345:respawn:/sbin/agetty -L -f /etc/issueserial 115200 ttyS0 vt100

####################################################

# Run xdm in runlevel 5

x:5:respawn:/etc/X11/prefdm -nodaemon

———————————————————————————————–

[root@oscar root]# vi /etc/issueserial

———————————————————————————————–

SECU-L4

Connected on \\l at \\b bps

\\U

————————————————————————————————-

[root@oscar root]# init q

4. 접속 테스트

windows의 하이퍼터미널이나 linux minicom을 이용해서 접속 테스트를 진행한다.

여기서는 minicom을 이용해서 테스트를 진행하겠다.

1) minicom 환경설정

[root@oscar root]# minicom -s

– Serial port setup 선택

            +—–[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        |

            +————————–+

– 위와 같이 설정

  +———————————————————————–+

    | A –    Serial Device      : /dev/ttyS0                                   |

    | 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?                                                  |

    +———————————————————————–+

2) minicom 실행

[root@oscar root]# minicom

———————————————————————————————–

Welcome to minicom 2.00.0

OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n

Compiled on Jun 15 2004, 20:45:27.

Press CTRL-A Z for help on special keys

———————————————————————————————–

3) 터미널 닫기

ctrl A + Z, X

5. root 계정으로 접속 설정하기

[root@oscar root]# vi /etc/securetty

———————————————————————————————–

console

ttyS0

.

.

———————————————————————————————–

6. SYSTEM Console 로서의 시리얼 포트 설정

해당 부트로더에 맞게 설정을 하고 마지막으로 inittab 설정을 추가한다.

1) boot loader = grub

[root@oscar root]# vi /etc/grub.conf

———————————————————————————————–

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title Red Hat Enterprise Linux ES (2.6.9-22.0.1.EL)

        root (hd0,0)

        kernel /vmlinuz-2.6.9-22.0.1.EL ro root=LABEL=/ rhgb quiet console=ttyS0,115200

        initrd /initrd-2.6.9-22.0.1.EL.img

———————————————————————————————–

2) boot loader = lilo

[root@oscar root]# vi /etc/lilo.conf

———————————————————————————————–

.

append=”rhgb quiet root=LABEL=/ serial=0,115200n8 console=ttyS0,115200″

.

———————————————————————————————–

3) inittab 설정 추가

[root@oscar root]#

———————————————————————————————–

.

# Run gettys in standard runlevels

1:2345:respawn:/sbin/mingetty tty1

2:2345:respawn:/sbin/mingetty tty2

3:2345:respawn:/sbin/mingetty tty3

4:2345:respawn:/sbin/mingetty tty4

5:2345:respawn:/sbin/mingetty tty5

6:2345:respawn:/sbin/mingetty tty6

s0:2345:respawn:/sbin/agetty -L 115200 ttyS0 vt100

.

———————————————————————————————–

시리얼 콘솔을 연결해 놓은후 시스템을 재부팅하면 종료 화면부터 부팅화면까지 확인할 수 있다.

참고사이트 : http://www.vanemery.com/Linux/Serial/serial-console.html

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

2 Responses

  1. 2022년 6월 22일

    1deciduous

  2. 2023년 1월 26일

    3claimed

페이스북/트위트/구글 계정으로 댓글 가능합니다.