Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HOWTO] Using QNAP TS-221 as PXE server / iscsi target.
2013-09-06, 12:48 (This post was last modified: 2013-09-06 13:20 by jrsmile.)
Post: #1
[HOWTO] Using QNAP TS-221 as PXE server / iscsi target.
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:
Code:
#!ipxe
set keep-san 1
#set skip-san-boot 1
sanboot iscsi:192.168.178.39:::0:iqn.2004-04.com.qnap:ts-221:iscsi.win7.d60e45
exit

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:192.168.178.39:::0:iqn.2004-04.com.qnap:ts-221:iscsi.win7.d60e45
means connect to 192.168.178.39 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.
Code:
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:
Code:
user=admin
group=administrators
port=0
dhcp-match=ipxe,175
dhcp-boot=net:ipxe,tftp://192.168.178.39/go.ipxe
dhcp-range=192.168.178.0,proxy
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 192.168.178.0 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:
Code:
[/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.

done.
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:
http://wiki.qnap.com/wiki/Running_Your_O...at_Startup
and use the QPKG based method.

https://dl.dropboxusercontent.com/u/957526/iscsi.png

Cheers,
JR
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-09-09, 12:36
Post: #2
RE: [HOWTO] Using QNAP TS-221 as PXE server / iscsi target.
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-10-08, 15:10
Post: #3
RE: [HOWTO] Using QNAP TS-221 as PXE server / iscsi target.
for people that use the qnap without static ip you can adapt the dnsmasq startup script "/opt/etc/init.d/S56dnsmasq" from:
Code:
#!/bin/sh

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

rm -f /var/run/dnsmasq.pid

sleep 2
/opt/sbin/dnsmasq

to:

Code:
#!/bin/sh

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

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
/opt/sbin/dnsmasq
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-12-15, 19:15
Post: #4
RE: [HOWTO] Using QNAP TS-221 as PXE server / iscsi target.
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

user=admin
group=administrators
port=0
dhcp-match=ipxe,175
dhcp-boot=net:ipxe,tftp://192.168.2.2/go.ipxe
dhcp-range=192.168.2.2,192.168.2.10
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.
usually:
on the virtual box have this
loading 192.168.2.2:undionly.kpxe.0
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...
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)