Mikrotik RouterOS (x86) 과 CentOS 6.5 를 이용해서 Network Booting 을 구현해 보자.
TFTP (Trivial File Transfer Protocol) 는 파일을 전송하기 위한 프로토콜이다.
구조가 단순하고 구현이 쉽기 때문에 PXE 를 통한 Network Booting 등에서 많이 사용된다.
일단 TFTP 를 설치한다.
root 계정으로 로그인 한다.
tftp 설치 여부 확인
[root@localhost ~]# rpm -qa tftp tftp-server
[root@localhost ~]#
당연히 없다. 설치하자..
[root@localhost ~]# rpm -qa tftp tftp-server
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
tftp x86_64 0.49-7.el6 base 32 k
tftp-server x86_64 0.49-7.el6 base 39 k
Installing for dependencies:
xinetd x86_64 2:2.3.14-39.el6_4 base 121 k
Transaction Summary
================================================================================
Install 3 Package(s)
Total download size: 192 k
Installed size: 362 k
Is this ok [y/N]:
tftp 의 홈 디렉토리를 만들고 다운로드 테스트용으로 사용할 간단한 파일을 하나 작성한다.
[root@localhost ~]# rpm -qa tftp tftp-server
[root@localhost ~]#
[root@localhost ~]# mkdir /tftpboot
[root@localhost ~]# echo Test... > /tftpboot/testme
[root@localhost ~]# ll /tftpboot
total 4
-rw-r--r--. 1 root root 8 Jul 3 05:48 testme
[root@localhost ~]#
tftp 환경 설정
vi /etc/xinetd.d/tftp
server_args 와 disabled 부분을 수정한다.
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
이제 서비스를 띄우고 테스트 해 보자
# default: off
# /etc/init.d/xinetd start
Starting xinetd: [ OK ]
[root@localhost ~]# tftp local-4 localhost
localhost: bad port number
tftp>
tftp> quit
[root@localhost ~]#
아직 작동이 안된다.
SELinux 설정을 확인해 본다.
[root@localhost ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted
[root@localhost ~]#
SELinux 는 Security Enhanced Linux 로 Linux Kernel 의 보안을 획기적으로 높였다고 하는데
나는 아직 정확히 이해할 수 없어 일단은 disable 시키기로 한다.
(대부분의 사용자가 disable 시키고 사용하는 듯...)
[root@localhost ~]# sestatus
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
selinux 설정은 시스템을 리부팅해야 적용된다.
[root@localhost ~]# sestatus
reboot
시스템이 다시 부팅되면 selinux 설정을 다시 확인해 본다.
[root@localhost ~]# sestatus
[root@localhost ~]# sestatus
SELinux status: disabled
정상적으로 disable 되어 있다.
이제 다시 tftp 테스트를 해 보자.
[root@localhost ~]# sestatus
[root@localhost ~]# tftp -4 localhost
tftp> get testme
tftp>
아무런 오류 없이 tftp> 프롬프트가 나타났다.
실제로 파일을 받았는지 확인해 보자.
현재 디렉토리에 정상적으로 파일을 받아온 것을 확인할 수 있다.
이제 tftp 서버를 통해 파일을 주고 받는 게 가능하다.
localhost 가 아닌 다른 기기들간에 tftp 전송이 가능하려면 방화벽 설정을 확인해야 한다.
System / Administration / Firewall
Network Booting 을 위해서는 TFTP / WWW (HTTP) 가 열려 있어야 한다.
이제 이렇게 구성된 TFTP 서버를 이용해서 Network Booting 을 구현해 보자.
Post a Comment