PDA

Bekijk de volledige versie : [How to] PXE boot Server



gouryella
26-11-2008, 01:08
[How to] PXE boot Server (compressed guide) updated 29.3.2010

expectations:

PXE boot friendly net card / virtualbox with bridged adapter in network config (for testing)
asus in router operation mode with active DHCP
tested on wl500gp-1.9.2.7-d-r1222.trx after finished wengi guide

install xinetd (if you don't have)


ipkg update
ipkg upgrade
ipkg install xinetd
install tftp-hpa Trivial File Transfer Protocol Server


ipkg install tftp-hpa

add extra dnsmasq.conf, it will append to /etc/dnsmasq.conf during boot (thanks Sid)

nano /usr/local/etc/dnsmasq.conf
contents of dnsmasq.conf:

dhcp-boot=pxelinux.0,asus,192.168.1.1
asus=replece to your Host Name, 192.168.1.1=tftp server ip adress (may run outside asus for fastest transfer)
save:

flashfs save && flashfs commit && flashfs enable && reboot
example of config files (check Attached Files i'm providing all needed files for Windows 7 PE Boot and memtest x86)


mkdir /opt/tftpboot/pxelinux.cfg
nano /opt/tftpboot/pxelinux.cfg/default
nano /opt/tftpboot/boot.txt

contents of default:


display boot.txt
prompt 1
timeout 0
default winpe

label dsl
kernel dsl/linux24
append ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=dsl/minirt24.gz nomce noapic quiet boot_image=dsl/knoppix

label dos
kernel memdisk
append initrd=dos/Dos6.22.img

label memtest
kernel memdisk
append initrd=memtest/memtest.img

label winpe
kernel Boot/startrom.0

label gparted
kernel gparted/vmlinuz
append initrd=gparted/initrd.img boot=live union=aufs noswap quickreboot noprompt vga=788 fetch=http://192.168.1.1:81/filesystem.squashfs

label pmagic
kernel pmagic/bzImage
append initrd=pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw sleep=10 livemedia

contents of boot.txt:


Boot menu: gparted | dos | dsl | winpe | memtest | pmagic


get the pxelinux.0 and memdisk kernel from syslinux (or everything is in Attach Files)
put both files to /opt/tftpboot/
get the dos bootdisk image


mkdir /opt/tftpboot/dos
cd /opt/tftpboot/dos
wget http://www.allbootdisks.com/downloads/Disks/MS-DOS_Boot_Disk_Download47/Diskette%20Images/Dos6.22.img
you may need chmod, thanks wpte for checking my tutorial

chmod +x /opt/tftpboot/*.*
chmod +x /opt/tftpboot/pxelinux.cfg/*.*
It's all, try to boot dos from network...

Sid
26-11-2008, 18:50
Thanks for this guide !
There's simple way to store changes in dnsmasq.conf.
According to one of Oleg's posts /etc/dnsmasq.conf generates at every boot. To make any permanent changes you must create /usr/local/etc/dnsmasq.conf file, edit it as you wish and flashfs it. After that system will generate /etc/dnsmasq.conf as usual at every boot, but any lines stored in /usr/local/etc/dnsmasq.conf will be automatically appended to /etc/dnsmasq.conf

gouryella
26-11-2008, 22:13
Sid, thanks i update the guide.

wpte
27-11-2008, 01:37
wow... it actually boots dos without an emulator?
or is it a special compiled version?

never did any pxe booting, but it sure does looks interesting:D

gouryella
27-11-2008, 01:52
wow... it actually boots dos without an emulator?
or is it a special compiled version?

never did any pxe booting, but it sure does looks interesting:D
just read something about PXE, BOOTP, DHCP BOOT
http://en.wikipedia.org/wiki/Preboot_Execution_Environment
it' s not boot dos inside router, it's service for loading Operationg System or Routine to standart x86 PC(maybe other platform) over network card without needing hard drive, for an example.

wpte
28-11-2008, 22:54
just read something about PXE, BOOTP, DHCP BOOT
http://en.wikipedia.org/wiki/Preboot_Execution_Environment
it' s not boot dos inside router, it's service for loading Operationg System or Routine to standart x86 PC(maybe other platform) over network card without needing hard drive, for an example.

hmm...
just a bit like connecting a pc to the router via ssh
only then the opposite way and with some boot I guess:p

I might try it out, thanks for the how-to:D

bucasia
28-11-2008, 23:06
Hi gouryella,

I'm glad my post helped some (http://sysadminman.net/blog/archives/8)

I hadn't spotted that wordpress had screwed my quotes up with speech marks - I'll correct that now.

Thanks, Matt

wpte
04-12-2008, 23:10
hey I tried all those steps, and found my way into the network boot mode...
but for some reason I get error messages that it doesnt find pxelinux.cfg

rlea weird, I just can't seem to load anything:(

gouryella
06-12-2008, 13:07
wpte, pxe successfully load pxelinux.0, but not find pxelinux.cfg
pxelinux.cfg is a directory, inside is a file named default

dir dsl - damm small linux
dir Boot - windows pe 2.0 (bootmgr.exe is for windows booting)

wpte
06-12-2008, 15:08
yes, I have the folder with the file default...

in the tftp folder I have these other files:

boot.txt
Dos.6.22.img
memdisk
pxelinux.0

What is that bootmanager.exe maybe I need that one too?:confused:

wpte
06-12-2008, 15:20
well... I came a bit further...
I had to chmod all the files to complete access before it would work...
maybe handy to put in ur how-to:p

yay, finally booted into dos with my... banana?:confused::p

EDIT:
I cant boot DSL properly tho, it keeps saying it can't find knoppix filesystem...
I tried chmod, changing lower or upper case, putting it in a folder etc...

Any ideas?

gouryella
07-12-2008, 11:46
they are many version of dsl, i use it dsl-4.4.10-initrd.iso, but i dont' like dsl to much...
but the funny way is booting something like ubuntu or windows xp, moving tftp server on fastest ethernet dhcp-boot=pxelinux.0,asus,192.168.1.5

wpte
07-12-2008, 13:06
they are many version of dsl, i use it dsl-4.4.10-initrd.iso, but i dont' like dsl to much...
but the funny way is booting something like ubuntu or windows xp, moving tftp server on fastest ethernet dhcp-boot=pxelinux.0,asus,192.168.1.5


I'll try that out then;)

I'm also trying to get puppy linux to boot from network, I have to build my own version, because the standart one doesnt work with pxe:p
Maybe I can upload it somewhere and share the version here when it's ready:)

msj33
12-12-2008, 21:58
Thanks for the Guide gouryella - Great work!

Got it all up an running.......But have one BIG problem!?!?

I wanna use a Image that is 700 MB in size, and i get the follwoing error:

Not enough memory to load specified image.

Is there someway to fix this? Or a workaround?!?!

Tried setting Ram-size to 10000 but without results.

Reason for the 700 MB ISO is, that this is a Slipstreamed version of XP SP2

I don't wanna use a DOs or Linux image, because i only want to use PXE for Backup purposes of my XP setups.

/Morten

gouryella
15-12-2008, 20:57
I dont' know how to boot XP, it's too dificult because XP isn't ready for PXE;
but the size: you can use nLite + bartPE for making XP CD up to 100MB;
Win PE 2.0 (Vista PE) is better way how to backup, u can use drivesnapshot too, it is booting directly image to ram very fast in 60seconds (125MB WIM).

nevel
08-03-2009, 11:16
Hello!

I've made everything as written in this instruction, but after booting with network machine getting ip, mask, gateway, dhcp and then starting TFTP.
But it ends after timeout and machine writes PXE-E32^ TFTP Open timeout.

chmod doesn't help...
Can someone help, please?

gouryella
08-03-2009, 12:59
Hello!

I've made everything as written in this instruction, but after booting with network machine getting ip, mask, gateway, dhcp and then starting TFTP.
But it ends after timeout and machine writes PXE-E32^ TFTP Open timeout.

chmod doesn't help...
Can someone help, please?

check(remap is for Vista PE):
nano /opt/etc/xinetd.d/tftp




service tftp
{
flags = REUSE
socket_type = dgram
protocol = udp
instances = 30
wait = yes
user = root
server = /opt/sbin/in.tftpd
server_args = -s /opt/tftpboot -m /opt/tftpboot/tftpd.remap -vvv
cps = 100 2
log_on_success = HOST PID
log_on_failure = HOST
disable = no
}

nano /etc/dnsmasq.conf (only last line is important)


user=nobody
resolv-file=/tmp/resolv.conf
no-poll
interface=br0
domain=asus
expand-hosts
no-negcache
dhcp-leasefile=/tmp/dnsmasq.log
dhcp-range=lan,192.168.1.2,192.168.1.254,86400
dhcp-option=lan,15,asus
read-ethers
dhcp-authoritative
dhcp-boot=pxelinux.0,asus,192.168.1.1

check if you have same domain and own username in your asus

dhcp-boot=pxelinux.0,asus,192.168.1.1

check from windows or inside router if transfer is succes:
tftp 192.168.1.1 GET pxelinux.0
tftp 192.168.1.1 -c get pxelinux.0 (linux)



btw: the tftp server can be on other PC(with windows) outside router like:
dhcp-boot=pxelinux.0,asus,ip where tftpd server running

Attached Files: folder with pxelinux.0, memdisk, configs, with working reduced image of dos

nevel
09-03-2009, 14:40
I'm affraid that the trouble is in the server part, because there is no process in.tftpd and if I run it manualy - it doesn't start, just trying as I understood, but router is alive and working. How much RAM does it need?

gouryella
09-03-2009, 18:46
I'm affraid that the trouble is in the server part, because there is no process in.tftpd and if I run it manualy - it doesn't start, just trying as I understood, but router is alive and working. How much RAM does it need?
in.tftpd is started from xine server, can not run manualy it apear only if needed

did you check:
tftp 192.168.1.1 GET pxelinux.0
tftp 192.168.1.1 -c get pxelinux.0 (linux)

nano /opt/etc/xinetd.conf


defaults
{
only_from = localhost 192.168.1.0/24
instances = 60
log_type = SYSLOG authpriv info
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
includedir /opt/etc/xinetd.d
# in this dir is tftp config file


nano /opt/etc/init.d/S10xinetd

#! /bin/sh
#
# Startup script for xinetd
#
prefix=/opt
sbindir=${prefix}/sbin

NAME=xinetd
DAEMON=${sbindir}/${NAME}
DESC="xinetd"
PIDFILE="/var/run/xinetd.pid"
OPTIONS="-pidfile $PIDFILE"
CONFDIR="/opt/etc/xinetd.d"

# installation check
test -x ${DAEMON} || exit 0

case "$1" in
start)
if [ -z "`pidof ${NAME}`" ] ; then
printf "Starting ${DESC}: "
${DAEMON} ${OPTIONS}
printf "${NAME}.\n"
fi
;;
stop)
if [ -n "`pidof ${NAME}`" ]; then
printf "Stopping ${DESC}: "
kill -SIGTERM `cat $PIDFILE`
printf "${NAME}.\n"
for i in ${CONFDIR}/* ; do
if [ -n "`grep
"^[[:space:]]*disable[[:space:]]*=[[:space:]]*no" ${i}`" ] ; then
daemon="`basename $(awk -F=
'/^[[:space:]]*server[[:space:]]*=[[:space:]]*.*/{print $2}' ${i})`"
printf "Stopping ${daemon}: "
kill "`pidof ${daemon}`" > /dev/null 2>&1
printf "${daemon}.\n"
fi
done
fi
;;
reload|reconfigure)
if [ -n "`pidof ${NAME}`" ]; then
printf "Reloading ${DESC}: "
kill -SIGHUP `cat $PIDFILE`
printf "${NAME}.\n"
fi
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
*)
printf "Usage: $0
{start|stop|reload|reconfigure|restart|force-reload}\n" >&2
exit
;;
esac

exit 0

try to run xine and watch for errors

cd /opt/etc/init.d/
sh S10xinetd start


tftp not eat any ram

andrei.pop
19-03-2009, 09:45
Hello,

I tried this tutorial but it doesn't seem to work for me, a little help would be appreciated.

I have the following network configuration:

Speedtouch ADSL 4 port (DHCP enabled) (192.168.1.1)
|
Asus WL-500gP using Oleg 1.9.2.7-10, connected to Speedtouch (192.168.1.2)
|
Asus GigaX1105N gigabit switch, connected to Asus WL-500gP

I have one desktop connected directly in the gigabit switch and I tried to do e PXE boot but it failed, couldn't see the error message, but I guess it could not connect to TFTP server on wl500gp.

I tried testing the tftp like above, first doing a tftp get request from wl500gp ssh (it worked), and then from my Asus laptop connected wireless to wl500gp (it didn't worked, timeout, but i could see an entry in the router log saying something like Xinetd tftp started from 192.168.1.3 - the ip of my laptop).

I also modified something /opt/etc/xinetd.d/tftp. user = root doesn't seem to work because there is no such user (this is what was written in the log), so i changed it from "root" to "admin".

So, bottom line,

tftp 192.168.1.2 GET pxelinux.0 (windows) - failed
tftp 192.168.1.2 -c get pxelinux.0 (linux) - ok
pxe boot using desktop - failed

Does anybody have an ideea?

Thanks!

gouryella
19-03-2009, 11:21
Hello,

I tried this tutorial but it doesn't seem to work for me, a little help would be appreciated.

I have the following network configuration:

Speedtouch ADSL 4 port (DHCP enabled) (192.168.1.1)
|
Asus WL-500gP using Oleg 1.9.2.7-10, connected to Speedtouch (192.168.1.2)
|
Asus GigaX1105N gigabit switch, connected to Asus WL-500gP

I have one desktop connected directly in the gigabit switch and I tried to do e PXE boot but it failed, couldn't see the error message, but I guess it could not connect to TFTP server on wl500gp.

I tried testing the tftp like above, first doing a tftp get request from wl500gp ssh (it worked), and then from my Asus laptop connected wireless to wl500gp (it didn't worked, timeout, but i could see an entry in the router log saying something like Xinetd tftp started from 192.168.1.3 - the ip of my laptop).

I also modified something /opt/etc/xinetd.d/tftp. user = root doesn't seem to work because there is no such user (this is what was written in the log), so i changed it from "root" to "admin".

So, bottom line,

tftp 192.168.1.2 GET pxelinux.0 (windows) - failed
tftp 192.168.1.2 -c get pxelinux.0 (linux) - ok
pxe boot using desktop - failed

Does anybody have an ideea?

Thanks!

remove 1Gb switch and connect directly pc to wl500, the user=root is good note...
dnsmasq.conf must be:
dhcp-boot=pxelinux.0,asus,192.168.1.2

andrei.pop
19-03-2009, 11:34
I will try to remove 1Gb switch and connect directly pc to wl500, but what i find strange is that i couldn't connect to TFTP even when using my laptop connected wireless directly to my wl500.

This line "dhcp-boot=pxelinux.0,asus,192.168.1.2" is ok, it is exactly as i have it in the config.

I will keep you posted if it worked without the switch or not.

Thanks!

gouryella
19-03-2009, 14:03
I will try to remove 1Gb switch and connect directly pc to wl500, but what i find strange is that i couldn't connect to TFTP even when using my laptop connected wireless directly to my wl500.

This line "dhcp-boot=pxelinux.0,asus,192.168.1.2" is ok, it is exactly as i have it in the config.

I will keep you posted if it worked without the switch or not.

Thanks!pxe is imposible by wireless, but tftp must work

gouryella
19-03-2009, 14:07
I will try to remove 1Gb switch and connect directly pc to wl500, but what i find strange is that i couldn't connect to TFTP even when using my laptop connected wireless directly to my wl500.

This line "dhcp-boot=pxelinux.0,asus,192.168.1.2" is ok, it is exactly as i have it in the config.

I will keep you posted if it worked without the switch or not.

Thanks!
pxe is imposible by wireless, use ethernet, but tftp must work
sorry if:
tftp 192.168.1.2 -c get pxelinux.0 work inside router and
in /etc/dnsmasq.conf is at the end: dhcp-boot=pxelinux.0,asus,192.168.1.2
(asus is a Host Name in ip config LAN IP Setting in web interface)
i can't provide any other help

andrei.pop
19-03-2009, 14:27
I know that wireless pxe is not possible, of course, what i was saying was that i tried to connect to tftp from the laptop using vista tftp client and i couldn't connect. From within asus it was ok.

But i will try to remove the switch from the schema and see how it works.

Thanks

andrei.pop
19-03-2009, 22:37
So finally i managed to get it working but only in a VMWARE machine. I started DOS 6.22, Damn Small Linux etc.

I didn't removed the switch from the schema, but I disabled the dhcp service on the speedtouch modem and enabled it on wl500. Still, my 2 desktop machines do not boot from dhcp, only the vmware machine.

Why?:confused:

gouryella
21-03-2009, 18:33
now i am thinking about booting ubuntu using pxe/tftp and nfs server :confused:

andrei.pop
22-03-2009, 01:12
That would be great. If you succeed please post here how you did it.

wpte
22-03-2009, 14:58
now i am thinking about booting ubuntu using pxe/tftp and nfs server :confused:

you do know, that you need to have at least 1.2GB ram to run ubuntu properly if you want to do that?
since the image is going to be placed on the RAM (about 700MB) and then it will need 512MB ram to run...

so... it will load up slowly and ubuntu is not really a live linux distro:p

gouryella
22-03-2009, 16:48
you do know, that you need to have at least 1.2GB ram to run ubuntu properly if you want to do that?
since the image is going to be placed on the RAM (about 700MB) and then it will need 512MB ram to run...

so... it will load up slowly and ubuntu is not really a live linux distro:p
yes it will load slowly ~3MB/s, but boot image takes about 8(initrd.gz) + 2MB(vmlinuz) other files load directly to ram(not ramdisk) only if needet fron nfs, i thing.
now i have problems with nfs server, export list not work well & no smart tutorial is here in english...

nfs is working now for me

/opt/nfs/ 192.168.1.1/24(rw,insecure,sync,all_squash,anonuid=0,anongid=0 )
the next step is in this tutorial, just follow it:
https://help.ubuntu.com/community/DisklessUbuntuHowto

sorry guys i freeze on NFS over TCP is not running on the router, mean that nfs is ok but some rpc service is not installed :-(

CrazyTSTer
23-03-2010, 01:06
Can any one help me?
I want to load knoppix.6.2.ru.iso (size 700MB) with PXE
Because my /opt partition size iz 512MB i have made directory in /tmp/mnt/[my_usb_drive]/knoppix and extract where 3 files from knoppix.6.2.ru.iso(linux, minirt.gz and KNOPPIX)
my /opt/tftpboot/pxelinux.cfg/default is


display boot.txt
prompt 1
timeout 0
default Knoppix

label Knoppix
kernel /tmp/mnt/[my_usb_drive]/knoppix/linux
append ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/tmp/mnt/[my_usb_drive]/knoppix/minirt.gz nomce noapic quiet boot_image=/tmp/mnt/[my_usb_drive]/knoppix/knoppix

label DSL
kernel /dsl/linux24
append ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 initrd=/dsl/minirt24.gz nomce noapic quiet boot_image=/dsl/knoppix

but it doesn't work


couldn't find /tmp/mnt/[my_usb_drive]/knoppix/linux


DSL Linux is booting up, but says


Can't find KNOPPIX filesystem, sorry.
Dropping you to a (very limited) shell.

why he says that?
what can i do to solve my problems?

wpte
23-03-2010, 01:55
why he says that?
what can i do to solve my problems?

you need to have all the data in the tftpboot dir...

creating a symlink in the tftpboot dir would probably solve the problem

ln -sf /opt/tftpboot/knoppix /tmp/mnt/[my_usb_drive]/knoppix

I dunno how you want to do it exactly, this is just an example
this will create a "shortcut" to your /tmp/mnt/[my_usb_drive]/knoppix directory.
Shortcuts are also like real files or folders, so you will see a new folder /opt/tftpboot/knoppix with the contents of the /tmp/mnt...

then you can redirect the tftpboot config to the /opt directory:)

CrazyTSTer
23-03-2010, 11:16
you need to have all the data in the tftpboot dir...

creating a symlink in the tftpboot dir would probably solve the problem

Ok, tnx, i'll try

And what about DSL Linux? I can boot only kernel... why?

CrazyTSTer
23-03-2010, 23:45
you need to have all the data in the tftpboot dir...

creating a symlink in the tftpboot dir would probably solve the problem

this solution doesn't work
also DSL under question
plz help

gouryella
26-03-2010, 21:45
I thing 700MB is too much for PXE, the better way is using nfs or fetch squash filesystem from webserver.
http://wl500g.info/attachment.php?attachmentid=6219&d=1269646520

wpte
26-03-2010, 22:50
I thing 700MB is too much for PXE, the better way is using nfs or fetch squash filesystem from webserver.

not necessarily, you also need enough ram to load it up.
You need at least 700MB to save the image in RAM as well as the normal required RAM for running it:)

plus, loading 700MB takes some time with 3MB/s:D

gouryella
27-03-2010, 02:37
The right knoppix settings is something like (knoppix 6.2):

label knoppix
kernel knoppix/linux
append ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=791 xmodule=fbdev initrd=knoppix/minirt.gz nomce quiet loglevel=0 tz=localtime
append initrd=knoppix/KNOPPIX


btw. i update the guide (http://wl500g.info/showthread.php?t=17156), now include files for windows 7 PE booting, memtest x86 and readme.txt for some pxe distributions

postbusjj
04-06-2010, 12:23
The attached tftpboot.zip is broken?
Can't download it... says its invalid.

gouryella
04-06-2010, 14:00
The attached tftpboot.zip is broken?
Can't download it... says its invalid.
I have no problem with it, anyway...

postbusjj
07-06-2010, 10:51
Thanks!
Dunno what's happening/happened. This zip I can download. Just checked the file from 1st post again... works, though it crashes my browser :eek:
Well, I have it... now. Cheers.

FilimoniC
20-01-2011, 23:46
IN THIS TUTORIAL:
If you see this in syslog (see it via web-ui)

Jan 21 01:39:45 xinetd[148]: Unknown user: root [file=/opt/etc/xinetd.d/tftp] [line=11]
Jan 21 01:39:45 xinetd[148]: Error parsing attribute user - DISABLING SERVICE [file=/opt/etc/xinetd.d/tftp] [line=11]
Jan 21 01:39:45 xinetd[148]: Service tftp missing attribute user - DISABLING
Jan 21 01:39:45 xinetd[148]: 148 {init_services} no services. Exiting...
Jan 21 01:40:22 xinetd[157]: Unknown user: root [file=/opt/etc/xinetd.d/tftp] [line=11]
Jan 21 01:40:22 xinetd[157]: Error parsing attribute user - DISABLING SERVICE [file=/opt/etc/xinetd.d/tftp] [line=11]
Jan 21 01:40:22 xinetd[157]: Service tftp missing attribute user - DISABLING
Jan 21 01:40:22 xinetd[157]: 157 {init_services} no services. Exiting...
Jan 21 01:43:20 xinetd[183]: Unknown user: root [file=/opt/etc/xinetd.d/tftp] [line=11]
Jan 21 01:43:20 xinetd[183]: Error parsing attribute user - DISABLING SERVICE [file=/opt/etc/xinetd.d/tftp] [line=11]
Jan 21 01:43:20 xinetd[183]: Service tftp missing attribute user - DISABLING
Jan 21 01:43:20 xinetd[183]: 183 {init_services} no services. Exiting...

You must edit
/opt/etc/xinetd.d/tftp
and set

user = admin
instead of

user = root
(you must use router's login. default is admin)