NetBoot HOW-TO

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO

#1 Post by phLe »

It is rather simple to setup a puppy boot server that will allow other PCs on the local network to boot puppy out of the network.
This HOWTO as several parts
  • Use case
    What is needed
    Principal of operation
    Get prerequisites
    Local test (with only one PC and without any network)
    Configuration
    Files layout
    Test
Last edited by phLe on Thu 25 Nov 2010, 14:26, edited 3 times in total.

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO: Use case

#2 Post by phLe »

I have customized puppy to be used by my students in the class room. I choosed a liveOS for not having to install it in every PC. Only one PC, acting as a server and running live puppy out of USB key is enough for all PCs in the classroom run puppy in a very reliable way.

I have another requirement, I want my DHCP server not interfere with the corporate DHCP server serving all other PC, and more, even for the PCs used in my classroom by my students, I want them to use the corporate DHCP Server, once puppy is booted.
Last edited by phLe on Thu 25 Nov 2010, 14:54, edited 3 times in total.

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO what is needed

#3 Post by phLe »

  • Recent puppy, in my case: puppy 5.1.1
    Monolithic lupu-511.sfs, due to a puppy bug, don't use a zl511332.sfs !
    The PCs must not be too old and must have at least 256M (for my full feature puppy) because you have no choice but running puppy all in RAM
    A not too slow LAN: 100BT is correct. For testing, 2 PC linked by a simple X-cable are OK.
    A puppy initramfs customized for net boot ( aka humongous initrd )
    Two additionnal software: dnsmasq and syslinux
    Some patience (but testing is very easy)
Last edited by phLe on Thu 25 Nov 2010, 14:05, edited 2 times in total.

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO: Principal of operation

#4 Post by phLe »

On powering-on the client PC, one have to ask the BIOS to boot out of the network (aka PXE Boot).

The BIOS issues a DHCP request, identifying itself by its MAC address and with a Vendor Class of PXEClient.

The DHCP server answer this request with usual network information, but with additional infos needed by the PXEClient for going on booting. Usually these infos are only "where to find the bootloader", but in my case, I add info about where to find the bootloader config file.

Once this info is received, the PXEClient download form the TFTP server the bootloader described by the answer received by the DHCP Server.

The BIOS PXEClent pass control to the bootloader just downloaded and exits.

In our case this bootloader is PXELINUX. It first reads its configuration file, either a default one, or, if any, the one the name of which was in the answer received from the DHCP server (my case).

After reading this config, PXELINUX acts exactly as SYSLINUX, ISOLINUX, or EXTLINUX, displaying images and menu if any exits.

PXELINUX load linux kernel and the humongous initramfs from the TFTP server.

PXELINUX passes control to the init shell script in the initramfs.

This init script try to find lupu-511.sfs in the computer devices, and because it doesn't find it, discover that it is here, in the initramfs, so it uses it.

This ends the special stages for a netboot.
Last edited by phLe on Thu 25 Nov 2010, 15:03, edited 4 times in total.

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO: Get prerequisite

#5 Post by phLe »

A) The humongous initramfs

All that is needed is copying monolithic lupu-511.sfs in initrd

Code: Select all

mkdir bigInitramfs.d
cd bigInitramfs.d
zcat /path/to/your/initrd.gz  | cpio -i -d
cp /path/to/your/lupu-511.sfs  .
find . | cpio -o -H newc | gzip -9 > ../bigInitramfs.gz 
B) dnsmasq
I found dnsmasq-2.46-i486-v0.2.pet obsolete (nov. 2006), so I installed dnsmasq-2.55 from ubuntu, and put the binary dnsmasq on my USB key.

C) SYSLINUX
I wanted recent boot-loader, so I downloaded SYSLINUX 4.03 from upstream: nothing to compile, needed files are there, I only had to copy them to my USB key.
Last edited by phLe on Thu 25 Nov 2010, 15:07, edited 3 times in total.

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO: local test

#6 Post by phLe »

Modify your bootloader config ( isolinux.cfg or extlinux.conf) with this line

Code: Select all

append initrd=bigInitramfs.gz
No need for ramsize parameter (it's for obsoleted initrd, nowadays linux uses initramfs which is much more clever).

Caution:
If there exists any lupu-511.sfs anywhere, in any device connected to your PC, puppy will uses it, and ignore the one which is present in initramfs !

Boot puppy and admire how well it works with your all in one initramfs.

It's useless to go further if you don't have success at this stage/
Last edited by phLe on Thu 25 Nov 2010, 15:07, edited 1 time in total.

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO configuration

#7 Post by phLe »

On the USB key I use for booting my live puppy server, I have, next to binary dnsmasq this shell script:

Code: Select all

#!/bin/sh
# MagicZaurus January 2009 for Puppy Linux GPL.
# Based on script from SLAX.
# Enhanced by Ecomoney August 2009
# Customized by Ph. Lelédy

PXE_IP=$(ifconfig "$(ls -1 /sys/class/net | grep eth | head -n 1)" | grep "inet addr" | cut -d : -f 2 | cut -d " " -f 1)
IP_BASE=$(echo $PXE_IP | cut -d "." -f 1-3)

if [ "$PXE_IP" != "" ]; then
killall dnsmasq 2>/dev/null
mkdir -p /var/lib/misc/
./dnsmasq  \
 --port=0 \
 --dhcp-vendorclass=set:PXE,PXEClient \
 --tag-if=set:notPXE,tag:!PXE \
 --dhcp-ignore=tag:notPXE \
 --dhcp-range=tag:PXE,$IP_BASE.110,$IP_BASE.200 \
 --no-ping \
 --dhcp-boot=pxelinux.0 \
 --dhcp-option-force=tag:PXE,208,F1:00:74:7E \
 --dhcp-option-force=tag:PXE,209,"default" \
 --dhcp-option-force=tag:PXE,210,"pxelinux.cfg/" \
 --dhcp-option-force=tag:PXE,211,30 \
 --enable-tftp \
 --tftp-root=$(pwd)/tftpboot \
 $*
 # --test
 # -k, --keep-in-foreground 
 # -d, --no-daemon
 else
	echo "No IP assigned to network interface. Cannot start DHCP and TFTP server."
	gxmessage "No IP assigned to network interface. Cannot start DHCP and TFTP server. Please use the network connection wizard to connect to via Ethernet/LAN"
fi
Last edited by phLe on Thu 25 Nov 2010, 17:10, edited 3 times in total.

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO: file layout

#8 Post by phLe »

Here are relevant files:

Code: Select all

net-boot/
net-boot/dnsmasq
net-boot/tftpboot
net-boot/tftpboot/pxelinux.0
net-boot/tftpboot/pxelinux.cfg
net-boot/tftpboot/pxelinux.cfg/boot.msg
net-boot/tftpboot/pxelinux.cfg/bigInitramfs.gz
net-boot/tftpboot/pxelinux.cfg/logo.16
net-boot/tftpboot/pxelinux.cfg/vmlinuz
net-boot/tftpboot/pxelinux.cfg/help.msg
net-boot/tftpboot/pxelinux.cfg/default
net-boot/start.sh
Caution
Observe that file pxelinux.0 is at the root of the TFTP as is the directory pxelinux.cfg. This places are mandatory if you want to use the default location and name ( in my case, I choosed to explicitly set all of them through --dhcp-option-force= )

For your undertanding, here is the config file for pxelinux: exactly the same as for any XXXLINUX of the same family:

Code: Select all

default puppy
display boot.msg
prompt 1
timeout 50

F1 boot.msg
F2 help.msg

LABEL puppy
SAY Booting Puppy Linux from PXE-Server PhL
KERNEL vmlinuz
APPEND initrd=bigInitramfs.gz pkeys=fr
Last edited by phLe on Thu 25 Nov 2010, 17:15, edited 4 times in total.

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO test

#9 Post by phLe »

For a not disturbing test, have a micro LAN between only 2 PC by plugging a cross-cable between the server and the client.
On the server

Code: Select all

ifconfig eth0 172.16.123.101
cd /path/to/your/usb/net-boot/
. start.sh -d
The flag -d will give you wonderful debugging information.

On the client, boot asking BIOS to do a PXE boot.

Observe the results in both server and client. It doesn't take too long.

Observe that your DHCP accepts requests at PXEClient time but ignores them once puppy is started, thanks to

Code: Select all

 --dhcp-vendorclass=set:PXE,PXEClient \
 --tag-if=set:notPXE,tag:!PXE \
 --dhcp-ignore=tag:notPXE \
You can put your server in production without disturbing normal (i.e. not PXEboot) operations in your corporate network.

Ph. Lelédy
Last edited by phLe on Thu 25 Nov 2010, 15:12, edited 1 time in total.

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

NetBoot HOW-TO: not for beginners

#10 Post by phLe »

I probably made a mistake putting this HOW-TO in wrong beginners section.
Can anybody put it in a better suited place ?
Ph. L.

raffy
Posts: 4798
Joined: Wed 25 May 2005, 12:20
Location: Manila

Flash

#11 Post by raffy »

Paging Flash - see post directly above.

This is good stuff for net-booting with Puppy. Thanks!

One problem in net-booting is making do with 256 MB RAM of the thin client. This requires the humongous initrd to be under 128 MB.
Puppy user since Oct 2004. Want FreeOffice? [url=http://puppylinux.info/topic/freeoffice-2012-sfs]Get the sfs (English only)[/url].

phLe
Posts: 13
Joined: Thu 25 Nov 2010, 11:59

A liitle update for French localized Linux server.

#12 Post by phLe »

The setting of dnsmasq I proposes works well in various environements.
I use it also on SliTaz or Ubuntu server to PXE boot SliTaz.

However, there is a little bug when using french localized Linux. The english word "address" is "adresse" in french. So the grep on "addr" is buggy. I had to replace it by a grep on "ad".

Ph.L.

gcmartin

#13 Post by gcmartin »

Removed
Last edited by gcmartin on Thu 10 Feb 2011, 19:03, edited 2 times in total.

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#14 Post by jrb »

I have adapted phLe's, MagicZaurus, and ecomoney's code along with dnsmasq-2.55-1 into a .pet.

I have tested it on Wary105, Quirky130, Lupu511, Puppy431, and my Pupserver435 with three different versions of humongous puppies and it works as described above by phLe on my home network.

1.) Install the .pet
2.) Place (or link) your netbootable initrd.gz, and your vmlinuz files in /root/netboot
3.) Choose Netboot_Server_Start from the Network menu. (or type "ppxe start" in a console window)

and you're good to go. (You can stop the server by typing "ppxe stop" in a console window)

Anxious to hear how it works on other people's systems.

Thanks phLe, MagicZaurus and ecomoney!

Cheers, J
Attachments
dnsmasq-2.55-1-i486-0.1.pet
PXE boot server
(95.25 KiB) Downloaded 624 times

Master_wrong
Posts: 452
Joined: Thu 20 Mar 2008, 01:48

#15 Post by Master_wrong »

to make this tutorial complete, i add this important link...

http://www.murga-linux.com/puppy/viewto ... 8&start=15
Cluster-Pup v.2-Puppy Beowulf Cluster
[url]http://www.murga-linux.com/puppy/viewtopic.php?p=499199#499199[/url]

gcmartin

#16 Post by gcmartin »

Removed

Post Reply