PXE Boot
序
RCNP のネットワーク内で PXE を用いたネットワークブートができると良いという話がある。例えば、vmegr, vmelas というホストネームの VME CPU (V7768) など。特に、2019-2021年RCNP 加速器アップグレードに伴い、WN コースの中性子フラックスが10倍のオーダーで増大するため、なるべくCPU を積んでいるデバイスのディスクレス化をしたい。V7768 では、なぜかコンパクトフラッシュがよく死ぬので、ディスクレスにしたい。
Ubuntu 18.04 LTS
$ sudo apt-get install dnsmasq pxelinux syslinux-common
$ wget http://www.memtest.org/download/5.01/memtest86+-5.01.bin.gz $ gzip -dk memtest86+-5.01.bin.gz $ ls memtest86+-5.01.bin
Useful links
- dhcp-match: mac address,set=red? https://etherarp.net/dnsmasq/
- “dnsmasq - different tftp-root for each macaddress” https://stackoverflow.com/questions/40008276/dnsmasq-different-tftp-root-for-each-macaddress
- “Advanced dnsmasq techniques” https://forums.fogproject.org/topic/8726/advanced-dnsmasq-techniques
- “ネットブートLinuxシステム構築メモ” http://i.cla.kobe-u.ac.jp/murao/docs/NetbootLinux/index.html
- “PXE Server on Existing Network (DHCP Proxy) with Ubuntu” https://manski.net/2016/09/pxe-server-on-existing-network-dhcp-proxy-on-ubuntu/
- “既存のDHCPサーバが存在する場合でもPXE Bootをする(dnsmasqを使ったProxy DHCPの設定)” http://zappy.hatenablog.jp/entry/2018/05/31/190434
Memo
- Q. PXE ブートに DHCP サーバーは必要か?
- A. 必要。参考: Is it possible that PXE without a DHCP/BOOTP sever? https://software.intel.com/en-us/forums/intel-business-client-software-development/topic/305159
- ディスクレスにする場合、なんらかの方法でイメージファイルを置いてあるサーバーの場所(言い換えると、TFTPサーバーのIPアドレス)をVME CPU に教える必要がある。通常は、DHCP サーバーの設定を書き換え、VME CPU がDHCP サーバーから IP アドレスを取得するタイミングで(?)TFTP の場所を教えてもらう。VME CPU のPXE の ROM を直接書き換えて、TFTP サーバーのIPアドレスをハードコーディングできないかとも考えたが、上記のリンクを見る限り、PXE の仕様上無理らしい?
- ディスクレスを諦めれば、ブートローダから、PXELINUX をロードできる。PXELINUX ロード時にTFTPサーバーのIPアドレスの情報をオプション(APPEND?)で与えることができるので、DHCP サーバーの設定に変更を加えることなくネットワークブートが実現できそう。ただ、そうするとディスクレスという本来の目的が達成できない。
- 外川との立ち話の結論は次の通り。もちろん DHCP の設定をネットワーク管理者に変更してもらえば良いが、それをやると、ネットワーク管理サイドも実験者サイドも引き継ぎ時の対応などが大変。なるべく 既存の DHCP の設定はいじりたくない。
- 1つの解は、ローカルネットワークを作って自前でDHCP サーバーを運用すること。ただ、それはそれでルーターの設定が面倒。
- やはり、既存のネットワーク上で dnsmasqを走らせるのが良いか?
Memo 2
- Scientific Linux CERN 6.3 (i386nonpae) を yum groupinstall “Base” –nogpgcheck –repofrompath=slc6.8,http://linuxsoft.cern.ch/cern/slc63/i386nonpae –forcearch=i686 –installroot=/var/lib/tftpbot/vme7671.slc6.8/root でインストールした後、diskless client の PXE boot を行ったところ、起動はしたが、何故か名前解決しなかった。/etc/resolv.conf はただしそうだったが。。。なぜ?–installroot ではなく、普通にインストールしたものをコピーしたら、うまく行った。
- /Linux/cern/slc68/i386nonpae/images/pxeboot の initrd.img は diskless client の カーネルとしては使えない。Choose a Language などといったインストールが始まってしまう。dracut でカーネルイメージを作るべし。
- Two network card configuration of DNSMASQ
# Configuration file for dnsmasq. # # Format is one option per line, legal options are the same # as the long options legal on the command line. See # "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details. # Listen on this specific port instead of the standard DNS port # (53). Setting this to zero completely disables DNS function, # leaving only DHCP and/or TFTP. port=0 # Log lots of extra information about DHCP transactions. log-dhcp interface=eno1 interface=eno2 # Uncomment this to enable the integrated DHCP server, you need # to supply the range of addresses available for lease and optionally # a lease time. If you have more than one network, you will need to # repeat this for each network on which you want to supply DHCP # service. dhcp-range=192.168.2.0,proxy dhcp-range=172.16.192.0,proxy # 172.16.209.19 is interfere the PXE boot. # Set the boot filename for netboot/PXE. You will only need # this if you want to boot machines over the network and you will need # an TFTP server; either dnsmasq's built-in TFTP server or an # external one. dhcp-boot=tag:eno1,pxelinux.0,192.168.2.82 dhcp-boot=tag:eno2,pxelinux.0,172.16.210.62 #dhcp-boot=pxelinux.0,192.168.2.28 # Loads <tftp-root>/pxelinux.0 from other TFTP server. pxe-service=tag:eno1,x86PC,"PXE boot for V7768 & V7807",pxelinux,192.168.2.82 pxe-service=tag:eno2,x86PC,"PXE boot for V7768 & V7807",pxelinux,172.16.210.62 #pxe-service=x86PC,"PXE boot for V7768 & V7807",pxelinux,192.168.2.28 # Nobu Kobayashi added on Apr. 8, 2021 # List the MAC addresses of the VME-CPU clients. # When it is matched, "vmematched" tag is set # (tag is an inner parameter of dnsmasq). dhcp-host=00:20:38:05:B6:BC,set:vmematched # vmessd G1 port dhcp-host=00:20:38:05:B6:BD,set:vmematched # vmessd G2 port dhcp-host=00:20:38:06:46:AC,set:vmematched # vmepla dhcp-host=00:20:38:06:46:AD,set:vmematched # vmepla2 dhcp-host=00:20:38:03:37:6C,set:vmematched # vmegr dhcp-host=00:20:38:03:37:6E,set:vmematched # vmegr2 #dhcp-host=00:20:38:03:37:6F,set:vmematched # vmegr3 #dhcp-host=00:20:38:03:37:5B,set:vmematched # vmehata #dhcp-host=00:20:38:03:5D:DC,set:vmematched # vmelas #dhcp-host=00:20:38:03:5D:D9,set:vmematched # vmelas2 dhcp-host=00:20:38:01:B9:FE,set:vmematched # vme-v7671-test dhcp-host=00:20:38:01:B9:FF,set:vmematched # vme-v7671-test-gp # Responds only to VME devices dhcp-ignore=tag:!vmematched