본문 바로가기
컴퓨터 & IT (Computer & IT)/Beowulf Cluster (Diskless Cluster)

[Diskless Cluster] 1.1 마스터 서버 - IP 네트워크 설정

by Physics 2020. 6. 2.
728x90

1.1. 마스터 서버 - IP 네트워크 설정

마스터 서버의 IP네트워크 설정을 통해서, 마스터 서버는 계산노드들에게 사설 IP주소를 할당한다. 이를 통해, 계산노드들이 마스터 서버와 통신을 주고받을 수 있게 된다. 이 장에서 해야할 목록은 다음과 같다:

     (a) dhcp 서버 설치  
     (b) /etc/hosts 편집  
     (c) /etc/dhcp/dhcp.conf 편집
     (d) /etc/network/interfaces 편집

해당 장에 들어가기 앞서, 다음 dhcp[2][3]와 /etc/hosts[1]에 대한 설명을 먼저 본 후, 어떤 내용을 다루는지 확인하기 바란다. 


1.1.1 DHCP 서버 설치

$sudo apt-get install isc-dhcp-server -y

 

1.1.2 /etc/hosts 편집
/etc/hosts를 편집하는 내용들은 마스터 서버의 사설 IP주소, 각 계산노드들의 사설 IP주소, 그리고 그에 대응되는 컴퓨터들의 호스트이름을 기입한다

$vim /etc/hosts
127.0.0.1 	localhost
127.0.1.1 	cmt323-server

192.168.0.1 	master
192.168.0.2 	node01
192.168.0.3 	node02
...
192.168.0.9 	node08

 

1.1.3 /etc/dhcp/dhcp.conf 편집
  (a) /etc/dhcp/dhcp.conf에서 아래처럼 작성을 하자. 일부 설명을 하면 다음과 같다

$vim /ec/dhcp/dhcp.conf 
allow booting; 
allow bootp;
ddns-upate-style none;
option omain-name "example.org";
option omain-name-servers ns1.example.org, ns2.example.org;
defaultlease-time 600;
max-leae-time 7200;
log-facility local7;

subnet 192.168.0.0	netmask	255.255.255.0 {
	option	routers			192.168.0.1;
	option	broadcast-address	192.168.0.255;
	option	domain-name-severs	192.168.0.1;
	next-server			192.168.0.1; 
	filename		“pxelinux.0”; 
	#option root-path	“/tftpboot/”
	host 	node01 { 
 		hardware ethernet XX:XX:XX:XX:XX:XX;
 		fixed-address		192.168.0.2;
 		option host-name	“node01”;
	}	
	…
	host	node08 {
		hardware ethernet XX:XX:XX:XX:XX:XX;
 		fixed-address		192.168.0.9;
		option host-name	“node08”;
	} 
}

 

(b) dhcp.conf 옵션 설명
    • allow booting: 계산노드들이 PXE 부팅 시 마스터노드로부터 IP 할당을 받는 것을 허가한다. 
    • allow bootp  : 계산노드들이 bootp 부팅하는 것을 허가한다. (?) 
    • subnet 이후에는 CMT cluster에서 내부망으로 사용될 네트워크를 정의하는 곳이다. 
      - option routers/ domain-name-servers/ next-server는 마스터 서버의 내부망 IP주소(192.168.0.1)를 기입하자. 
      - next-server: TFTP server가 있는 IP주소 
      - option root-path : TFTP server에서 부트로더가 있는 장소*
      - filename “pxelinux.0” : 네트워크 부트스트랩 프로그램의 이름 
      - hardware ethernet: 계산노드들의 네트워크 카드의 맥주소를 기입한다. 
      - fixed-address : 계산노드에게 할당할 고정 ip를 기입한다. 
      - option host-name : 계산노드에게 할당할 hostname을 지정한다. (2.1.3 참조)

       *나는 /var/lib/tftpboot/를 부트로더 장소로 사용하여 추가적으로 기입하지 않았다)

1.1.4 /etc/network/interfaces 편집 
현재 CMT Cluster의 마스터 서버에는 내부망과 외부망을 연결해주는 2개의 네트워크 카드가 설치되어있다. 
/etc/network/interfaces를 편집함으로써, 마스터 서버의 내부망 IP주소를 192.168.0.1로 고정시킨다.

$vim /etc/network/interfaces 

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp8s0
iface enp8s0 inet dhcp

auto    enp3s0
iface   enp3s0	inet static
        address		192.168.0.1
        network		192.168.0.0
        netmask		255.255.255.0
        broadcasat  	192.168.0.255
        gateway     	192.168.0.1

 

The primary network interface 아래 부분을 자신의 네트워크 이더넷에 맞춰 설정한다. 내가 제작한 Diskless cluster의 경우, 네트워크 이더넷의 구성은 다음과 같다.  
   1) enp8s0: 외부망과 연결되어있는 네트워크 카드
   2) enp3s0: 내부망과 연결되어있는 네트워크 카드 
사용하고 있는 컴퓨터의 상태에 따라 enp8s0, enp3s0의 이름이 바뀔 수 있으므로 해당 컴퓨터에 맞춰서 작업을 진행한다.

※ 2021-04-13: 사용하고 있는 클러스터가 고장이 나서 ubuntu 20.04로 다시 만드는 중에 몇가지 코멘트를 할 부분이 생긴 것 같다. 
- 내부망의 고정 ip 할당 부분에 gateway를 지워야 할 것 같다. 정확한 이유는 아직 잘 모르겠지만, 고정 ip 부분에 gateway가 있는 상태에서 systemctl restart networking으로 네트워크를 재시작하면 내부망 이더넷 카드에 대해서 RTNETLINK answers: file exists 와 같은 오류 메시지가 나온다. 이 상태에서 ifdown으로 내부망 이더넷을 끄려고 하면 "ifdown: interface enp6s0 not configured"과 같은 메시지가 나온다. 또한 "ip addr flush dev <내부망 이더넷>"을 입력한 후, ifup으로 내부망 이더넷을 다시 키려고 하면 동일하게 RTNETLINK answers: file exists가 나오게 된다. 구글링을 통해서 찾은 정보를 통해서, /etc/network/interfaces의 내부망 부분의 gateway를 없엔 후, "ip addr flush dev <내부망 이더넷>"을 입력한 후, 다시 ifup으로 네트워크 이더넷을 켜니 이제야 오류 메시지가 나오지 않게 되었다. 


1.1.4 /etc/default/isc-dhcp-server 편집 

$vim /etc/default/isc-dhcp-server
INTERFACES=”enp3s0 enp8s0”


1.1.5 마스터 노드 네트워크 재시작    

$/etc/init.d/isc-dhcp-server restart 
$/etc/init.d/networking restart
$sudo reboot 
$sudo systemctl status isc-dhcp-server 
$sudo systemctl status networking.server

 /etc/init.d/isc-dhcp-server와 networking을 재시작한다. 다만, 내 경험과 몇몇 인터넷에서 본 자료에 따르면, 처음에  
    /etc/init.d/networking restart를 하면 설정이 먹히지 않는 경우가 있었다. 그럴 경우에는 리부팅을 통해서 설정이 적용되도록 하자. 
systemctl status를 통해 네트워크와 DHCP 서버가 잘 작동하는지 확인하자. (그림 1)

 

그림 1. status isc-dhcp-server

여기까지 작업을 하면, 계산노드들이 부팅하는 방식을 PXE boot[4]로 설정한 경우에 아래 그림.2와 같이 마스터 서버로부터 IP주소를 할당받는 것을 확인할 수 있다. 하지만 그림에서 볼 수 있듯이, PXE-error가 발생한 이유는 계산노드가 마스터 서버로부터 적절한 부트로더 파일을 받지 못했기 때문에 발생한 것이다. 다음 장에서는 계산노드들이 사용할 부트로더 파일에 대해서 다룬다.

 

그림 2. 계산노드의 pxe 부팅 중 마스터 서버로부터 사설 ip 받기 및 PXE 오류

 

 


[1] https://m31phy.tistory.com/40

[2] https://m31phy.tistory.com/41

[3] https://m31phy.tistory.com/45

[4] PXE 부팅과 관련된 내용은 다음을 참조: m31phy.tistory.com/70

728x90

댓글