LoginSignup
2
3

More than 5 years have passed since last update.

PXEbootの設定

Posted at

DHCPサーバーが既にルーターなどで設定、稼働している場合に、新たにPXEブート用サーバーを設置する方法をまとめる。


前提

ネットワークセグメント:192.168.1.0
PXEブート用サーバー:192.168.1.100
PXEブート用サーバーOS:CentOS7

1. ProxyDHCPの設定

PXEブート用サーバーをproxyDHCPとtftpで兼用する。
proxyDHCPとして、dnsMasqを使う。

# yum install dnsmasq dnsmasq-utils

/etc/dnsmasq.d/tftpを作成し、以下を追記。
(/etc/dnsmasq.confの内容とかぶらないように注意。今回はdnsmasq.confが全てコメントアウトされたので問題なし

port=0
log-dhcp
dhcp-range=192.168.1.0,proxy
dhcp-boot=pxelinux.0,192.168.1.100
pxe-service=x86PC,"Network Boot",pxelinux,192.168.1.100

サービス起動

# systemctl start dnsmasq

2. TFTPサーバーの設定

# yum install tftp-server
# systemctl status tftp

設定は特にないが、tftpのルートを変える場合は、以下の設定ファイルを変える。
今回は、デフォルトの/var/lib/tftpbootを使う。
/etc/xinetd.d/tftp

3. SYSLINUXの設定

# yum install syslinux syslinux-tftpboot

CentOS用ブートローダーを取得

CentOS7
# mkdir /var/lib/tftpboot/centos7
# cd /var/lib/tftpboot/centos7
# wget http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
# http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz

CentOS6
# mkdir /var/lib/tftpboot/centos6
# cd /var/lib/tftpboot/centos6
# wget http://mirror.centos.org/centos/6/os/x86_64/images/pxeboot/initrd.img
# http://mirror.centos.org/centos/6/os/x86_64/images/pxeboot/vmlinuz

4. PXEブート用メニューを作成

# cd /var/lib/tftpboot/
# mkdir pxelinux.cfg
# vi pxelinux.cfg/default

上記で取得したCentOSブートローダーを入れる場合は、以下のようになる。

DEFAULT menu.c32
PROMPT 0
TIMEOUT 300
ONTIMEOUT Local

MENU TITLE PXE Boot Menu

LABEL Local
        MENU LABEL 1. Local HardDisk Drive
        LOCALBOOT 0

LABEL CentOS7 x86_64
        MENU LABEL 2. CentOS7 x86_64
        kernel centos7/vmlinuz
        append load initrd=centos7/initrd.img

LABEL CentOS6 x86_64
        MENU LABEL 3. CentOS6 x86_64
        kernel centos6/vmlinuz
        append load initrd=centos6/initrd.img

LABEL Reboot
        MENU LABEL 4. Reboot
        COM32 reboot.c32

LABEL Poweroff
        MENU LABEL 5. Poweroff
        COMBOOT poweroff.com

debian系の設定追加

まとめ中

参考
http://zappy.hatenablog.jp/entry/2018/05/31/190434
http://www.maruko2.com/mw/PXE%E3%83%96%E3%83%BC%E3%83%88%E7%94%A8%E3%82%B5%E3%83%BC%E3%83%90%E3%82%92%E6%A7%8B%E7%AF%89%E3%81%99%E3%82%8B
https://www.unix-power.net/networking/post-672
http://www.mikitechnica.com/14-centos72-pxe.html
https://www.hiroom2.com/2016/05/05/ubuntu-16-04-debian-8%E3%81%ABpxe%E3%83%96%E3%83%BC%E3%83%88%E3%82%B5%E3%83%BC%E3%83%90%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%97%E3%81%A6%E3%83%8D%E3%83%83%E3%83%88%E3%83%AF%E3%83%BC%E3%82%AF%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E7%92%B0%E5%A2%83%E3%82%92%E6%95%B4%E3%81%88%E3%82%8B/#sec-5
https://ameblo.jp/shinnaka54/entry-12409911643.html
http://arborvitae.oops.jp/dokugaku/%E5%82%99%E5%BF%98%E9%8C%B2/pxe-boot/

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3