Diskless nodes/ko

This HOWTO will help with creating and setting up diskless nodes with Gentoo Linux.

이 설명서 정보
This HOWTO will help setting up diskless workstations based on the Gentoo Linux distribution. This is guide is intended to make the process as user friendly as possible and cater to the Linux newbie, because everyone was at a certain point :) While an experienced user could easily tie the multiple HOWTOs available on diskless nodes and networking together it's hoped that this guide can ease the installation for all interested users, geeks or not.

무(無) 디스크 머신이란게 뭔가요?
A diskless machine is a PC without any of the usual boot devices such as hard disks, floppy drives or CD-ROMs. The diskless node boots off the network and needs a server that will provide it with storage space as a local hard disk would. From now on the server will be the master, while the diskless machine gets called the slave (what's in a name :). The slave node needs a network adapter that supports PXE booting or Etherboot; check Etherboot.org for support listings. Most modern cards support PXE and many built-in adapters on motherboards will also work.

Before starting
Gentoo should be installed on the master node and enough space on the master to store the file systems of the slave nodes that are going to be hosted. Also make sure there is one interface to the internet separated from the local area connection.

커널 설명
The kernel is the software that sits between the hardware and all other software that is loaded on the machine, essentially the heart of a kernel based operating system. When a computer is started, the BIOS executes the instructions found at the reserved boot space of the hard drive. These instructions are typically a boot loader that loads a kernel. After a kernel has been loaded all processes are handled by the kernel.

For more information on kernels and kernel configuration check out the kernel HOWTO.

마스터 커널 설정
The master kernel can be as large and as customized as desired but there are a few required kernel options that need to be selected. Go into the kernel configuration menu by typing:

There should be a grey and blue GUI that offers a safe alternative to manually editing the file. If the kernel is currently functioning well it might be a good idea to save the current configuration file by exiting the GUI and typing:

Go into the following sub-menus and make sure the listed items are checked as built-in (and NOT as modular). The options show below are taken from the 2.6.10 kernel version. If a different version is used, the text or sequence might differ. Just make sure to select at least those shown below.

If access to internet through the master node is required and/or a secure firewall is needed make sure to add support for iptables:

If packet filtering is required, add the rest as modules later. Make sure to read the Gentoo Security Handbook Chapter about Firewalls on how to set this up properly.

After the master kernel has been re-configured, it needs to be rebuilt:

Then add an entry for that new kernel into or  depending on which bootloader that is being used and make the new kernel the default one. Now that the new bzImage has been copied into the boot directory all that has to be done is to reboot the system in order to load these new options.

슬레이브 커널 알아보기
It is recommended that the slave kernel be compiled without any modules, since loading and setting them up via remote boot is a difficult and unnecessary process. Additionally, the slave kernel should be as small and compact as possible in order to efficiently boot from the network. The slave's kernel is going to be compiled in the same place where the master was configured.

혼동을 막고 시간을 절약하기 위해 마스터의 설정 파일을 다음 명령을 입력하여 백업하시는게 좋습니다:

The slave's kernel is now to be configured in the same fashion as the master's kernel. If a fresh configuration file is needed it can be recovered from the default file by typing:

이제 다음 명령을 입력하여 설정 화면으로 이동하십시오:

Make sure to select the following options as built-in and NOT as kernel modules:

Now the slave's kernel needs to be compiled. Be careful here not to overwrite or mess up the modules (if any) that have been built for the master:

Now create the directory on the master that will be used to hold slaves' files and required system files. The is used but any location preferred may be chosen here. Now copy the slave's bzImage into the directory:

슬레이브 파일 시스템 기반 설정
The master and slave filesystems can be tweaked and changed a lot. Right now the only point of interest is in getting a preliminary filesystem of appropriate configuration files and mount points. First it's required to create a directory within for the first slave. Each slave needs its own root file system because sharing certain system files will cause permission problems and hard crashes. These directories can be called anything the administrator deems appropriate but the author suggests using the slaves IP addresses as they are unique and not confusing. The static IP of the first slave will be, for instance,  :

Various configuration files in need to be altered to work on the slave. Copy the master's directory onto the new slave root by typing:

이 파일시스템은 더 많은 마운트 지점과 디렉터리가 필요하기 때문에 아직 준비되지 않았습니다. 이들을 만들려면 다음 명령을 입력하십시오:

Most of these "stubs" should be recognizable; stubs like,  or  will be populated when the slave starts, the others will be mounted later. The file should also be changed to reflect the hostname of the slave. Binaries, libraries and other files will be populated later in this HOWTO right before attempting to boot the slave.

Even though is populated by   later on, the  entry needs to be created. If not, the error message "unable to open initial console" will be encountered.

DHCP 서버 알아보기
DHCP는 동적 호스트 설정 프로토콜(Dynamic Host Configuration Protocol)의 약자입니다. DHCP 서버는 PXE 부팅을 시작할 때 가장 먼저 통신할 컴퓨터입니다. DHCP 서버의 주된목적은 IP 주소 할당입니다. DHCP 서버는 호스트의 이더넷 MAC 주소를 기반으로 IP 주소를 할당할 수 있습니다. 슬레이브에서 IP 주소를 받으면, DHCP 서버는 초기 파일 시스템과 커널이 어디있는지 슬레이브에게 알려줍니다.

Before getting started
There are several things to make sure of, that they are working properly before beginning. First check the network connectivity:

Make sure there is an eth0 device running. It should look something like this:

It's important that it says MULTICAST, if it doesn't then the kernel will have to be recompiled to include multicast support.

DHCP 서버 설치
If the network does not already have a DHCP server installed, one needs to be installed now:

If the network already has a DHCP server installed, edit the configuration file to get the PXE boot to function correctly.

DHCP 서버 설정
There is only one configuration file that needs to be edited before starting the DHCP server:. Copy and edit the provided sample file:

의도한 방식 대로의 파일의 일반 구성은 다음과 같습니다:

The  block is optional and should be used for IPs that are required to be assigned that belong to the same network topology. At least one  must be declared and the optional   block allows options to be grouped between items. A good example of looks like this:

The IP address after  will be asked for the specified. This IP address should be the IP of the tftp server, usually the same as the master's IP address. The  is relative to the  directory (this is due to the tftp server specific options which will be covered later). Inside the  block, the   option specifies a MAC address, and   assigns a fixed IP address to that particular MAC address. There is a pretty good man page on with options that are beyond the scope of this HOWTO. The man page can be read by typing:

DHCP 서버 시작하기
Before starting the dhcp initialization script edit the file so that it looks something like this:

The  variable is the device that the DHCP server will be running on, in this case. Adding more arguments to the  variable can be useful for a complex network topology with multiple Ethernet cards. To start the dhcp server type:

To add the dhcp server to the start-up scripts type:

DHCP 서버 문제 해결
To see if a node boots, take a look at. If the node successfully boots, the file should have some lines at the bottom looking like this:

If the following message is encountered it probably means there is something wrong in the configuration file but that the DHCP server is broadcasting correctly.

Every time after changing the configuration file the DHCP server must be restarted. To restart the server type:

TFTP 서버 알아보기
TFTP는 단순 파일 전송 프로토콜(Trivial File Transfer Protocol)을 의미합니다. TFTP 서버는 슬레이브의 커널과 초기 파일 시스템을 실어나릅니다. 모든 슬레이브 커널과 파일 시스템은 TFTP 서버에 저장하기 때문에, 마스터를 TFTP 서버로 만드는 것이 바람직합니다.

TFTP 서버 설치
가장 추천하는 tftp 서버는 tftp-hpa 패키지입니다. 이 tftp 서버는 SYSLINUX를 만든 사람이 만들었으며 pxelinux와 가장 잘 동작합니다. 설치하려면 다음과 같이 간단하게 입력하십시오:

TFTP 서버 설정
Edit. The tftproot directory needs to specified with  and any command line options with. It should look something like this:

The  option indicates that this server listens in stand alone mode so inetd does not have to be run. The  indicates that log/error messages should be verbose. The  specifies the root of the tftp server.

TFTP 서버 시작하기
tftp 서버를 시작하려면 다음 명령을 입력하십시오:

This should start the tftp server with the options that were specified in the. If this server is to be automatically started at boot type:

PXELINUX 알아보기
This section is not required if only Etherboot is being used. PXELINUX is the network bootloader equivalent to LILO or GRUB and will be served via TFTP. It is essentially a tiny set of instructions that tells the client where to locate its kernel and initial filesystem and allows for various kernel options.

Before getting started
Now the file pxelinux.0 is required, which comes in the SYSLINUX package by H. Peter Anvin. This package can be installed by typing:

PXELINUX 설정
Before starting the tftp server pxelinux needs to be set up. First copy the pxelinux binary into the directory:

이 과정에서 기본 부트로더 설정 파일을 만듭니다. 16진수 클라이언트 IP 주소로 된 파일이 있는지 바이너리에서  디렉터리를 찾아봅니다. 파일이 없다면 파일 이름의 가장 오른쪽 자리를 지우고, 숫자가 바닥날 때까지 계속 찾습니다. 2.05 이상의 syslinux에서는 먼저 MAC 주소 다음의 파일 이름에 대해 검색을 수행합니다. 찾은 파일이 없다면, 앞서 언급한 발견 루틴을 따라갑니다. 발견한 파일이 없다면 파일을 사용합니다.

파일로 시작해보겠습니다:

The  tag directs pxelinux to the kernel bzImage that was compiled earlier. The  tag appends kernel initialisation options. Since the slave kernel was compiled with , the nfsroot will be specified here. The first IP is the master's IP and the second IP is the directory that was created in to store the slave's initial filesystem.

Etherboot 알아보기
Etherboot boots network boot images from a TFTP server. As the PXE this is equivalent to LILO or GRUB. The  utility enables the creation of different images using different options.

Before getting started
The  (utility for making tagged kernel images useful for netbooting) package is needed to create the Etherboot images. This tool will create a preconfigured kernel image from the original kernel. This contains the boot options as shown further down.

Etherboot 설정
In this section a simple etherboot image will be created. As the dhcp server gives out the clients root-path in the "option root-path" dhcp.conf, this does not have to be included here. More details can be found in the mknbi manual.

부팅 이미지를 만들겠습니다. DHCP에서 전달할 수 있는 ELF 부팅 이미지를만들고 커널의 루트 경로에 넣겠습니다. 또한 커널에서 네트워크 상의 DHCP 서버를 탐색하도록 커널에 지시합니다.

네트워크 부팅 과정 문제 해결
There are a few things that can be done to debug the network boot process. Primarily a tool called  can be used. To install  type:

Now various network traffic can be listened to, to make sure the client/server interactions are functioning. If something isn't working there are a few things that could be checked. First make sure that the client/server is physically connected properly and that the networking cables are not damaged. If the client/server is not receiving requests on a particular port make sure that there is no firewall interference. To listen to interaction between two computers type:

The  command can also be configured to listen on particular port such as the tftp port by typing:

A common error that might be received is: "PXE-E32: TFTP open time-out". This is probably due to firewall issues. If  is being used, it might be worth checking  and  and make sure that they are configured properly. The client should be allowed to connect to the server.

NFS 서버 알아보기
NFS stands for Network File System. The NFS server will be used to serve directories to the slave. This part can be somewhat personalized later, but right now all that is wanted is a preliminary slave node to boot diskless.

포트매퍼 알아보기
여러 클라이언트/서버 서비스에서는 각각의 포트에 대한 포트를 감청하지 않지만 RPC(원격 프로시저 호출)에 의존합니다. 서비스를 초기화하면 임의의 포트를 감청하며 이 포트를 포트매퍼 유틸리티에 할당합니다. NFS는 RPC에 의존하기 때문에 NFC를 시작하기 전에 포트매퍼를 실행해야 합니다.

Before starting
The NFS Server needs kernel level support so if the kernel does not have this, the master's kernel needs to be recompiled. To double check the master's kernel configuration type:

The output should look something like this if the kernel has been properly configured:

NFS 서버 설치
다음 명령을 입력하면 포티지를 통해 NFS 패키지를 설치할 수 있습니다:

이 패키지는 포트매핑 유틸리티, NFS 서버, NFS 클라이언트 유틸리티를 이머지하며, 의존성 초기화를 자동으로 처리합니다.

NFS 서버 설정
There are three major configuration files that will have to be edited:

파일은 어떻게 누구에게 무얼 NFS를 통해 내보낼 것인지 지정합니다. 슬레이브의 fstab의 내용이 바뀌어서 마스터가 내보내는 NFS 파일 시스템에 마운트할 수 있게 됩니다.

보통 마스터의 는 다음과 같습니다:

첫번째 내용은 내보낼 디렉터리고, 다음 내용은 누구에게 어떻게 내보낼 것인지를 나타냅니다. 이 내용은 각각의 디렉터리에 누가 마운트할 수 있어야 하는지, 마운트한 클라이언트가 파일 시스템에서 할 수 있는 일은 무엇인지 두 부분으로 나뉩니다. 는 읽기 전용을 의미하고 는 읽기/쓰기를 의미합니다. 와  옵션은 디스크에 기록하는 무 디스크 클라이언트에 중요하므로 입출력 요청이 나타나면 "압축"하지 않습니다. 슬레이브의 파일은 다음과 같아야 합니다:

In this example, master is just the hostname of the master but it could easily be the IP of the master. The first field indicates the directory to be mounted and the second field indicates where. The third field describes the filesystem and should be NFS for any NFS mounted directory. The fourth field indicates various options that will be used in the mounting process (see mount(1) for info on mount options). Some people have had difficulties with soft mount points so here they are made hard mounts, a look into various options should be done to make the cluster more efficient.

The last file that should be edited is which describes a few options for nfs when it is initialised and looks like this:

The  should be changed to the number of diskless nodes on the network.

NFS 서버 시작하기
The nfs server should be started with its init script located in by typing:

If this script is to be started every time the system boots simply type:

빠진 파일 복사
Now the slave's file system will be made in sync with the master's and provide the necessary binaries while still preserving slave specific files.

무디스크 네트워크 설정
In order to prevent the networking initscript from killing the connection to the NFS server, an option needs to be added to on the diskless client's filesystem.

초기화 스크립트
Init scripts for slaves are located under for services needed on the diskless nodes. Each slave can be set up and customized here, it all depends on what each slave is meant to do.

Now is a good time to boot the slave and cross some fingers. It works? Congratulations, you are now the proud owner of (a) diskless node(s).