2009年4月29日水曜日

gpxeとdnsmasq (まとめ1)

dnsmasqの設定がある程度固まりました。

/etc/dnsmasq.conf (抜粋)

interface=eth0
dhcp-option=15,"sesame.local"
dhcp-option=6,192.168.0.254

dhcp-range=net1,192.168.0.100,192.168.0.200,12h
dhcp-option=net1,3,192.168.0.254
conf-dir=/etc/dnsmasq.d/conf.d



/etc/dnsmasq.d/conf.d/tftpd.conf(抜粋)

##### default boot pxe-gpxelinux.0-bootmenu ######

# pxelinux.magic
#dhcp-option-force=208,f1:00:74:7e
# Configuration file name
dhcp-option-force=209,conf/bootmenu.cfg
# Path prefix
dhcp-option-force=210,http://192.168.3.20/gpxe/
# Reboot time. (Note 'i' to send 32-bit value)
#dhcp-option-force=211,60i

enable-tftp
dhcp-boot=gpxelinux.0
tftp-root=/var/lib/dnsmasq/tftpboot
log-dhcp

######## end default #############

### Sample: gpxelinux.0 - gpxelinux.cfg ####
#dhcp-mac = 43a2-gw, 00:0c:29:xx:xx:xx
#dhcp-option-force = 43a2-gw,209,43a2-gw.cfg

### pxe - undi - gpxe.scr ###

dhcp-userclass = gpxe , "gPXE"
dhcp-no-override

dhcp-mac = vmpxe1, 00:0c:29:xx:xx:aa
dhcp-boot = net:vmpxe1 , undionly.kpxe
dhcp-boot = net:gpxe, net:vmpxe1, "http://192.168.3.20/gpxe/43a2-gw.scr"

dhcp-mac = vmpxe2, 00:0c:29:xx:xx:bb
dhcp-boot = net:vmpxe2 , undionly.kpxe
dhcp-boot = net:gpxe, net:vmpxe2, "http://192.168.3.20/gpxe/gpxemenu.scr"

#600sc
dhcp-host = 00:11:22:33:44:55, net:600sc, 192.168.0.36
dhcp-boot = net:600sc , undionly.kpxe
dhcp-boot = net:gpxe, net:600sc, "http://192.168.3.20/gpxe/43a2-gw.scr"


########### end


/etc/dnsmasq.confから/etc/dnsmasq.d/conf.d/tftpd.confが読み込まれてネットブート関連の設定が読み込まれます。

---デフォルト---
tftpでgpxelinux.0を読み込み、http://192.168.3.20/gpxe/conf/bootmenu.cfgを読み込みます。

http://192.168.3.20/gpxe/conf/bootmenu.cfg:

DEFAULT vesamenu.c32
PROMPT 0

menu background conf/y150-1.jpg
menu title IPnuts pxe boot menu
prompt 0
timeout 1000
#allowoptions 0
menu timeoutrow 20
menu vshift 2
menu rows 8
menu color title 1;36;44 #ff8bc2ff #00000000 std
menu color unsel 37;44 #ff1069c5 #00000000 std
menu color sel 7;37;40 #ff000000 #ffff7518 all
menu color hotkey 1;37;44 #ffffffff #00000000 std
menu color hotsel 1;7;37;40 #ff000431 #ffff7518 all
menu color tabmsg 31;40 #90ffff00 #00000000 std
menu color cmdline 37;40 #c0ffffff #ff000000 std

LABEL 43a2-gw
MENU LABEL ^1. 43a-gw
KERNEL 43a2-gw/linux626.c01
APPEND initrd=43a2-gw/root626.c01

パスはhttp://192.168.3.20/gpxe/がプリフィックスでgpxelinux.0が動作しているので、vesamenu.c32はhttp://192.168.3.20/gpxe/にあり、イメージファイルのy150-1.jpgは
http://192.168.3.20/gpxe/confにあります。

---その他---

その他、macアドレスでIDを指定して、undionly.kpxeとそれぞれのスクリプトをチェインしています。

http://192.168.3.20/gpxe/gpxemenu.scr

#!gpxe
imgfree
show ip
chain vesamenu.c32 conf/gpxemenu.cfg

gpxemenu.scrがチェインされて、gpxemenu.scrのあるパスがカレントになるのでパスを設定するときは注意が必要です。

http://192.168.3.20/gpxe/conf/gpxemenu.cfg

menu background conf/y150-1.jpg
menu title IPnuts gpxe boot menu
#menu autoboot
prompt 0
timeout 1000
#allowoptions 0
menu timeoutrow 20
menu vshift 2
menu rows 8
menu color title 1;36;44 #ff8bc2ff #00000000 std
menu color unsel 37;44 #ff1069c5 #00000000 std
menu color sel 7;37;40 #ff000000 #ffff7518 all
menu color hotkey 1;37;44 #ffffffff #00000000 std
menu color hotsel 1;7;37;40 #ff000431 #ffff7518 all
menu color tabmsg 31;40 #90ffff00 #00000000 std
menu color cmdline 37;40 #c0ffffff #ff000000 std

LABEL 43a2-gw
MENU LABEL ^1. 43a-gw
KERNEL 43a2-gw/linux626.c01
APPEND initrd=43a2-gw/root626.c01

0 件のコメント: