2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ESXi+pxe+dhcp(ネットワークブート)

Last updated at Posted at 2018-02-13

PXEブートマシンに必要なPackage

syslinux
dhcp
tftp-server
httpd
xinetd

起動プロセス

httpd
xinetd	・・tftpはxinetdにて起動
dhcp

DHCP.conf

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet 192.168.1.0 netmask 255.255.255.0 {
   option subnet-mask         255.255.255.0;
   option dhcp-server-identifier 192.168.1.254;
   option broadcast-address 192.168.1.255;
   range dynamic-bootp        192.168.1.150 192.168.1.159;		   ←IPレンジの指定
   default-lease-time         21600;
   max-lease-time             43200;
   next-server                192.168.1.11;				       ←DHCPサーバ自身のIP
   filename                   "/esx_install/pxelinux.0";       ←PXEメニューのパス
}

tftp起動ファイル

 service tftp
 {
     socket_type             = dgram
    protocol                = udp
    wait                    = yes
    user                    = root
    server                  = /usr/sbin/in.tftpd
    server_args             = -c -u root -s /var/lib/tftpboot	     ←tftpルートディレクトリ
    disable                 = no				              ←デフォルトはdisableなので、enableに変更
    per_source              = 11
    cps                     = 100 2
    flags                   = IPv4
 }

PXEブート準備

/var/lib/tftpboot/esx_install配下に、pxelinux.0や、menu.c32、mboot.c32などのPXEブート用ファイルの配置
※rhelやcentと同様のsyslinuxパッケージからコピーでOK

# mkdir /var/lib/tftpboot/esx_install/
# cp -rp /usr/share/syslinux/* /var/lib/tftpboot/esx_install/.

続いて、/var/lib/tftpboot/esx_install配下に、導入したいESXiメディアの内容を丸っとコピーする

# mkdir /mnt/esxi6
# mount -t iso9660 /dev/cdrom /mnt/esxi6
# cp -rp /mnt/esxi6/* /var/lib/tftpboot/esxi_install/esxi6/

esxi6配下のboot.cfgの編集

まず、booot.cfgの全ての"/"を削除しておく(相対パスのため)
# sed -i 's/\///g' /var/lib/tftpboot/esx_install/esxi6/boot.cfg

★configファイルの準備
 PXE Bootサーバにて下記ファイルをMAC分(ESXホスト分)準備する

■bootmenuファイルの準備
pxelinux.cfgディレクトリを作成する

例:
# cd /var/lib/tftpboot/esx_install/pxelinux.cfg/
# vi 01-xx-xx-xx-xx-xx-xx               ←MAC別にconfigファイル準備しておく

	中身:
	DEFAULT menu.c32
	MENU TITLE ESXi-6.0.0-full Boot Menu
	NOHALT 1
	PROMPT 0
	TIMEOUT 80
	LABEL install
	KERNEL esxi6/mboot.c32
	APPEND -c esxi6/boot.cfg ks=http://192.168.1.11/esxi6/01-xx-xx-xx-xx-xx-xx.cfg
	MENU LABEL ESXi-6.0.0-full ^Installer

■MACアドレスのconfigも準備する
※MACアドレスの前に01-を付与する

例:
# cd /var/www/html/esxi6
# vi 01-xx-xx-xx-xx-xx-xx.cfg

	中身:
	vmaccepteula
	install --firstdisk --overwritevmfs
	rootpw password
	keyboard Japanese

	network --bootproto=static --ip=192.168.1.73 --gateway=192.168.1.5 --nameserver=192.168.1.47,192.168.1.48 --netmask=255.255.255.0 --hostname=<hostname> --addvmportgroup=1 --vlanid=1001

	reboot

	%firstboot --interpreter=busybox

	vim-cmd hostsvc/enable_ssh
	vim-cmd hostsvc/start_ssh
	vim-cmd hostsvc/enable_esx_shell
	vim-cmd hostsvc/start_esx_shell
	esxcli system module parameters set -m tcpip4 -p ipv6=0
	
	reboot
2
5
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
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?