iPXE discussion forum

Full Version: [HOWTO] Using QNAP TS-221 as PXE server / iscsi target.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there, i finally managed to get a Win7 booting via iscsi.
this is how i did it.

activate tftp server:
go to the NAS Webinterface and login with admin and your password.
open "Control Panel" then select "Applications" and "TFTP-Server"
on the right side select enable TFTP-Server use Port 69 and select a base folder.
Mine is called /PXE and was created especially for this reason with read only permissions.
download undionly.kpxe from here: http://boot.ipxe.org/undionly.kpxe and put it into the PXE folder.

then add a go.ipxe file with the following content:
set keep-san 1
#set skip-san-boot 1
sanboot iscsi:

thats it for the TFTP section now comes ISCSI.

in the "Control Panel" open the "Storage Manager" and and select the "ISCSI" tab.
under "Portal Management" "Enable ISCSI Target Service" on Port 3260.

under "Target Management" select "Quick Configuration wizzard" and create a iscsi target and LUN with your desired configuration. (Skip CHAP-auth and Mutual CHAP-auth)

in the "Summary Screen" write down the iqn path to your drive and adapt the go.ipxe file in your PXE folder to the correct name.
For example:
sanboot iscsi:
means connect to and fetch iqn.2004-04.com.qnap:ts-221:iscsi.win7.d60e45

now make sure you have the "Optware IPKG" Software installed via the "APP Center"
connect via ssh to your QNAP and issue the following commands.
ipkg update
ipkg install dnsmasq
(i did a "ipkg install nano" as well)
now edit the /opt/etc/dnsmasq.conf file and replace its content with:
pxe-service=net:#ipxe,x86PC, "lanboot", undionly.kpxe
user and group have to be admin and administrators to be able to start dnsmasq on the qnap. the port 0 disables the dnsmasq inbuild dns server.
dhcp-match identifies if a normal pxe or a ipxe client connects to the server.
pxe-service is needed as the dnsmasq service runs as dhcp-proxy and does not issue ip adresses to the client ( this is done by your existing router/dhcp server)
adapt all ips to your local network configuration.
the dhcp-range command specifies the proxy-dhcp method instead of a real dhcp server. any ip from the subnet can be specified so i took the to make this more visible the ",proxy" part enables the dhcp-proxy.

configuration summary:
dnsmasq only configured as dhcp-proxy
issues undionly.kpxe to all pxe clients
issues tftp://<nas-ip>/go.ipxe to all ipxe clients.

save the file and start dnsmasq via "/opt/etc/init.d/S56dnsmasq"
make sure it runs with "ps -aux | grep dnsmasq"
it should show:
[/etc/config] # ps -aux | grep dnsmasq    
2021 admin       484 S   grep dnsmasq
8345 admin       572 S   /opt/sbin/dnsmasq
[/etc/config] #

to install win 7 you have to uncomment the #set skip-san-boot 1 in /PXE/go.ipxe
otherwise it will not select the cd-rom after a failed sanboot. after installation you can comment it with a # again.

fire up KVM or QEMU and boot via PXE to test (VirtualBox does not work as it stops after a failed sanboot!!!).

specify Network boot and use a win7 iso as second boot option.
if everything went well you will be able to select the iscsi target as Harddrive during windows installation. if it is left blank check your configuration again.
dont forget to comment out set skip-san-boot 1 after first reboot.

ps: if you want to start dnsmasq during NAS bootup have a look here:
and use the QPKG based method.


Good of you to write up how you did it.

Just be aware that the keep-san and skip-san-boot flags are deprecated, and it is considered a better approach to use sanhook and sanboot respectively with a bit of scripting to do what is needed. Use http://ipxe.org/cmd/sanhook when you want to install to the iSCSI volume, and http://ipxe.org/cmd/sanboot when you're ready to boot the iSCSI volume itself.
for people that use the qnap without static ip you can adapt the dnsmasq startup script "/opt/etc/init.d/S56dnsmasq" from:

if [ -f /var/run/dnsmasq.pid ] ; then
  kill `cat /var/run/dnsmasq.pid`

rm -f /var/run/dnsmasq.pid

sleep 2



if [ -f /var/run/dnsmasq.pid ] ; then
  kill `cat /var/run/dnsmasq.pid`

rm -f /var/run/dnsmasq.pid

/bin/sed -i "/^dhcp-boot=/c\dhcp-boot=net:ipxe,http://$(grep -s IPADDR /etc/dhcpc/dhcpcd-eth0.info | sed 's/IPADDR=//g')/go.ipxe" /opt/etc/dnsmasq.conf

sleep 2
I, i try that you show but it doesnt work for me...

- enabled tftp server on qnap and the directory is /public
- set directory permission to readonly for the guest
- downloaded undionly.kpxe and copy into this directory (/public)
- created go.ipxe into same directory
- edit go.ipxe with a real iscsi target that i created before and copy the correct iqn
- i have a dsl d-link 2750b (it can be dchp server but it doenst have an option for tftp server... (maybe i dont found it?)) so i need my ts-469l be dhcp but if i enable it on ethernet 1 dnsmasq say that: "error already exist dhcp server"... to work i need to create a real dhcp server with dnsmasq (and disable the other) with this config with my real network

pxe-service=net:#ipxe,x86PC, "lanboot", undionly.kpxe

save it and start dnsmasq (my ps -aux)
[/etc/config] # ps -aux | grep dnsmasq
15761 admin 416 S /opt/sbin/dnsmasq
25005 admin 548 S < grep dnsmasq

now i can try to pxe boot but i have several errors.
on the virtual box have this
TFTP error 1 (no such file/no access)

by a netboot (boot agent PXE)

auto-select: lanboot
pxe-t01: no such file/no access
pxe-e3b: tftp error - file not found
pxe-m0f: exiting intel pxe rom

where is my problem??
last question.. if by anyone way i can boot without problem, to install windows i need to uncomment set skip-san-boot 1 but then i must boot from cd-rom (insert before) and i see the iscsi like a normal hard disk? or what?

thanks for the help! i need to have windows 7 diskless with pxe boot...
Reference URL's