Page 1 of 1

NetBoot HOW-TO

Posted: Thu 25 Nov 2010, 12:19
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

NetBoot HOW-TO: Use case

Posted: Thu 25 Nov 2010, 12:25
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.

NetBoot HOW-TO what is needed

Posted: Thu 25 Nov 2010, 12:36
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)

NetBoot HOW-TO: Principal of operation

Posted: Thu 25 Nov 2010, 13:03
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.

NetBoot HOW-TO: Get prerequisite

Posted: Thu 25 Nov 2010, 13:15
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.

NetBoot HOW-TO: local test

Posted: Thu 25 Nov 2010, 14:04
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/

NetBoot HOW-TO configuration

Posted: Thu 25 Nov 2010, 14:25
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

NetBoot HOW-TO: file layout

Posted: Thu 25 Nov 2010, 14:40
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

NetBoot HOW-TO test

Posted: Thu 25 Nov 2010, 14:50
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

NetBoot HOW-TO: not for beginners

Posted: Thu 25 Nov 2010, 14:52
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.

Flash

Posted: Sat 27 Nov 2010, 00:56
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.

A liitle update for French localized Linux server.

Posted: Thu 13 Jan 2011, 17:07
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.

Posted: Thu 13 Jan 2011, 19:17
by gcmartin
Removed

Posted: Fri 14 Jan 2011, 04:51
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

Posted: Fri 14 Jan 2011, 11:07
by Master_wrong
to make this tutorial complete, i add this important link...

http://www.murga-linux.com/puppy/viewto ... 8&start=15

Posted: Thu 20 Jan 2011, 23:31
by gcmartin
Removed