パッケージのインストール
# dnf install dnsmasq syslinux-tftpboot 1# dnf install dnsmasq syslinux-tftpboot
PXEサーバ設定
/etc/dnsmasq.d/proxy_pxe.conf
# function as a tftp server1# function as a tftp server2enable-tftp34# Don't function as a DNS server:5port=067# don't bind to 0.0.0.08bind-interfaces910# root directory for files available via ftp.11tftp-root=/tftpboot1213# This range(s) is for the public interface, where dnsmasq functions14# as a proxy DHCP server providing boot information but no IP leases.15# Any ip in the subnet will do, so you may just put your server NIC ip here.16# I used my router ip address17dhcp-range=192.168.1.0, proxy1819# kill multicast20dhcp-option=vendor:PXEClient,6,2b2122# disable reuse of the dhcp servername and filename fields as extra.23# option space. to avoid confusing some old or broken dhcp clients.24dhcp-no-override2526# Log lots of extra information about DHCP transactions.27log-dhcp28log-queries2930# PXE menu31pxe-prompt="Press F8 for boot menu", 103233# A boot service type of 0 is special, and will abort the34# net boot procedure and continue booting from local media.35pxe-service=X86PC, "Boot from local hard disk", 03637# The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86,38# Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI39pxe-service=X86PC, "Boot from network", lpxelinux

ブートメニューを作る
# mkdir /tftpboot/pxelinux.cfg1# mkdir /tftpboot/pxelinux.cfg
/tftpboot/pxelinux.cfg/default
default vesamenu.c321default vesamenu.c322prompt 13timeout 10045menu title ########## Boot Menu ##########6#menu background pxelinux.cfg/logo.png78label internet9menu label ^Install Fedora from InterNET10kernel http://192.168.1.10/netboot/fedora/vmlinuz11initrd http://192.168.1.10/netboot/fedora/initrd.img12append inst.stage2=http://download.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os/ ip=dhcp1314label live15menu label ^Boot Live Linux(puppy)16kernel http://192.168.1.10/netboot/puppy/vmlinuz17initrd http://192.168.1.10/netboot/puppy/initrd.gz18append root=/dev/ram01920label backup21menu label backup/recovery(g4l)22menu default23linux http://192.168.1.10/netboot/g4l/bz4x3.324initrd http://192.168.1.10/netboot/g4l/ramdisk.lzma25append root=/dev/ram02627label rescue28menu label ^System Rescue29linux http://192.168.1.10/netboot/systemrescue/rescue6430initrd http://192.168.1.10/netboot/systemrescue/initram.igz31append netboot=http://192.168.1.10/netboot/systemrescue/sysrcd.dat setkmap=jp scandelay=53233label memtest8634menu label ^Memory test35kernel memtest86plus36append -3738label local39menu label ^Boot from Local drive40localboot 0xffff

ブートイメージの作成
Fedora Install
# mkdir /tftpboot/fedora1# mkdir /tftpboot/fedora2# wget http://download.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os/images/pxeboot/vmlinuz -O /tftpboot/fedora/vmlinuz3# wget http://download.fedoraproject.org/pub/fedora/linux/releases/23/Server/x86_64/os/images/pxeboot/initrd.img -O /tftpboot/fedora/initrd.img

Puppy
# mkdir puppy1# mkdir puppy2# wget http://openlab.jp/puppylinux/download/puppy-5.7.1JP/precise-571JP.iso3# mount -o loop,ro -t iso9660 precise-571JP.iso puppy4# mkdir initrd5# cd initrd6# zcat ../puppy/initrd.gz | cpio -i -H newc -d75329 blocks8# cp ../puppy/puppy_precise_5.7.1JP.sfs .9# find | cpio -o -H newc | gzip -4 > ../initrd.gz10257025 blocks11# cd ..12# mkdir /tftpboot/puppy13# mv initrd.gz /tftpboot/puppy/.14# cp puppy/vmlinuz /tftpboot/puppy/.

g4l
# mkdir /tftpboot/g4l1# mkdir /tftpboot/g4l2# wget http://netix.dl.sourceforge.net/project/g4l/g4l%20ISO%20images/g4l-v0.50.iso3# mount -o loop,ro -t iso9660 g4l-v0.50.iso g4l4# cp g4l/bz4x3.3 /tftpboot/g4l/.5# cp g4l/ramdisk.lzma /tftpboot/g4l/.

SystemRescueCD
# mkdir systemrescuecd1# mkdir systemrescuecd2# wget http://jaist.dl.sourceforge.net/project/systemrescuecd/sysresccd-x86/4.7.1/systemrescuecd-x86-4.7.1.iso3# mount -o loop,ro -t iso9660 systemrescuecd-x86-4.7.1.iso systemrescuecd4# mkdir /tftpboot/systemrescuecd5# cp systemrescuecd/sysrcd.dat /tftpboot/systemrescuecd/.6# cp systemrescuecd/sysrcd.md5 /tftpboot/systemrescuecd/.7# cp systemrescuecd/isolinux/initram.igz /tftpboot/systemrescuecd/.8# cp systemrescuecd/isolinux/rescue64 /tftpboot/systemrescuecd/.9# umount systemrescuecd

Windows PE
WinPe-tchのダウンロード等

memtest86+
# wget http://www.memtest.org/download/5.01/memtest86+-5.01.zip 1# wget http://www.memtest.org/download/5.01/memtest86+-5.01.zip2# unzip memtest86+-5.01.zip3# mv memtest86+-5.01.bin /tftpboot/memtest86plus

apacheの設定
/etc/httpd/conf.d/netboot.conf
#
1#2# This configuration file maps net boot images3#4Alias /netboot /tftpboot56<location netboot="">7AllowOverride All8Require ip 192.168.1.0/249</location>
SELinuxの設定
/tftpboot に設定されているtftpdir_tにhttpdのアクセス許可を追加するが、セキュリティは大丈夫?気になるなら、イメージは別ディレクトリに移してhttpd_sys_content_tのtcontextを設定するとよい。
pxe.te
module pxe 1.0;1module pxe 1.0;23require {4type httpd_t;5type tftpdir_t;6class file { read open getattr };7}89#============= httpd_t ==============10allow httpd_t tftpdir_t:file { read open getattr };
# checkmodule -M - m - o pxe.mod pxe.te 1# checkmodule -M -m -o pxe.mod pxe.te2checkmodule: loading policy configuration from pxe.te3checkmodule: policy configuration loaded4checkmodule: writing binary representation (version 17) to pxe.mod5# semodule_package -o pxe.pp -m pxe.mod6# semodule -i pxe.pp7# restorecon -v -R /tftpboot
サービスを起動する
# systemctl start dnsmasq1# systemctl start dnsmasq2# systemctl status dnsmasq3● dnsmasq.service - DNS caching server.4Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled)5Active: active (running) since 金 2016-02-19 00:21:57 JST; 2s ago6Main PID: 1690 (dnsmasq)7CGroup: /system.slice/dnsmasq.service8└─1690 /usr/sbin/dnsmasq -k9102月 19 00:21:57 fedora.local.nerv.geek.jp systemd[1]: Started DNS caching server..112月 19 00:21:57 fedora.local.nerv.geek.jp systemd[1]: Starting DNS caching server....122月 19 00:21:57 fedora.local.nerv.geek.jp dnsmasq[1690]: started, version 2.75 DNS disabled132月 19 00:21:57 fedora.local.nerv.geek.jp dnsmasq[1690]: compile time options: IPv6 GNU-getopt DBus no-i18n IDN DHCP DHCPv6 no-Lu...notify142月 19 00:21:57 fedora.local.nerv.geek.jp dnsmasq-dhcp[1690]: DHCP, proxy on subnet 192.168.1.0152月 19 00:21:57 fedora.local.nerv.geek.jp dnsmasq-tftp[1690]: TFTP root is /tftpboot16Hint: Some lines were ellipsized, use -l to show in full.17# systemctl enable dnsmasq18Created symlink from /etc/systemd/system/multi-user.target.wants/dnsmasq.service to /usr/lib/systemd/system/dnsmasq.service.
# systemctl status httpd1# systemctl status httpd2● httpd.service - The Apache HTTP Server3Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)4Active: active (running) since 木 2016-02-18 22:29:52 JST; 1h 54min ago5Main PID: 940 (/usr/sbin/httpd)6Status: "Total requests: 9; Idle/Busy workers 100/0;Requests/sec: 0.00132; Bytes served/sec: 75KB/sec"7CGroup: /system.slice/httpd.service8├─ 940 /usr/sbin/httpd -DFOREGROUND9├─1195 /usr/sbin/httpd -DFOREGROUND10├─1196 /usr/sbin/httpd -DFOREGROUND11├─1197 /usr/sbin/httpd -DFOREGROUND12├─1198 /usr/sbin/httpd -DFOREGROUND13├─1200 /usr/sbin/httpd -DFOREGROUND14└─1391 /usr/sbin/httpd -DFOREGROUND15162月 18 22:29:48 fedora.local.nerv.geek.jp systemd[1]: Starting The Apache HTTP Server...172月 18 22:29:51 fedora.local.nerv.geek.jp httpd[940]: [Thu Feb 18 22:29:51.237904 2016] [core:warn] [pid 940] AH00114: Useless us....conf.182月 18 22:29:52 fedora.local.nerv.geek.jp systemd[1]: Started The Apache HTTP Server.19Hint: Some lines were ellipsized, use -l to show in full.
ポートを開ける
or# firewall-cmd -- add- service=http -- permanent 1# firewall-cmd --add-service=http --permanent2# firewall-cmd --add-service=dhcp --permanent3# firewall-cmd --add-service=tftp --permanent4# firewall-cmd --add-service=proxy-dhcp --permanent5# firewall-cmd --reload
# firewall-cmd -- set- default- zone=trusted 1# firewall-cmd --set-default-zone=trusted
0 件のコメント:
コメントを投稿