Parallel DHCP server installation recipe

A. Problem: Often we have to install a trial or even production LTSP
server and clients in a subnet populated by some other OS running its
own DHCP server. An LTSP DHCP server has to give out information about
addresses, kernels, root paths, etc.  specific to LTSP. We may not have
access to the other DHCP servers, or may want to eventually remove them;
but they interfere by filling LTSP client DHCP requests. Following the
principle that the problem is easer to solve once you move it into UNIX
space, we have to find a way to run a parallel DHCP setup, possibly
invisible to Windows (oops, I meant 'other OS'!).

B. Process: Consider a desktop (non-PCMCIA) LTSP client (we'll talk about
PCMCIA in  #I.2 below) and a stock LTSP setup. The following process
description is sufficient for our purposes.
   1. This client 'boots' off the Etherboot ROM/floppy and broadcasts
    a DHCP request for an IP address.
   2. The LTSP server provides an IP address and a path to a kernel.
   3. Client downloads the kernel using TFTP, boots it. At this stage
    the root FS is the ramdisk packaged with the kernel, and the booting
    process is defined in a file called 'linuxrc'. Unfortunately this
    kernel doesn't know the address and other information previously
    obtained from the DHCP server.
   4. Client does another round of DHCP and uses the address and root
    path information obtained to finish booting up.

C. Solutions:
We have (at least) 3 different approaches. I describe #1, then
give pointers to the other 2.

I. Run DHCP on a different port.
DHCP runs by default on ports udp/67 and udp/68. We can run independently of
the Windows server by using different ports. We need some changes on both the
server and client sides.
1. Server
Edit the DHCP daemon startup script to specify a different port. On Debian,
this is /etc/init.d/dhcp. Change the command inside this file to the following.
   /usr/sbin/dhcpd -- -p 1001 -q $INTERFACES
where,
   INTERFACES="eth0" or whichever interface you are using.

Restart the DHCP server. On Debian, this is done as follows.
   /etc/init.d/dhcp restart
It should then show up as follows in the output of `ps`.
   /usr/sbin/dhcpd -p 1001 -q

2. PCMCIA Client
Some machines such as notebooks, are connected to the ethernet network
with a PCMCIA or Cardbus card.  The PCMCIA stack is started late in the
kernel's bootup process, and there isn't any driver at this time that
is independent of the kernel. Therefore to be useful as an LTSP client,
these boot a kernel from a floppy disk, thereby skipping steps B.1-3.

2.1 Get the wireless_ltsp package. Now, in B.4, we need to change the dhclient
call in the linuxrc. This file is accessed by mounting the floppy image
as a block device. The kernel on the machine you use for this has to be
compiled with loopback device support (CONFIG_BLK_DEV_LOOP). You have
to be root in order to run the mount command.
   mount -o loop floppy.img /mnt
2.2 Now we get to the initrd image in the floppy image.
   cd <some_working_directory>
   cp /mnt/initrd.img <some_working_directory>
   gunzip -S .img initrd.img
   mount -o loop initrd /mnt1 
2.3 Change the dhclient call made by the PCMCIA sub-system in the file
/mnt1/etc/pcmcia/network.
   /bin/dhclient -p 1002 eth0 >/tmp/dhclient.out 2>&1
2.4 Unmount /mnt and /mnt1 and write the image to a floppy disk
   dd if=floppy.img of=/dev/fd0 bs=10240
Boot your client with it.

3. Desktop (non-PCMCIA) client
3.1 For initial DHCP request (B.1)
You need to compile your own Etherboot images. Obtain the latest Etherboot
code, and edit the following lines in <etherboot>/src/etherboot.h
   #define BOOTP_SERVER    1001
   #define BOOTP_CLIENT    1002
Make your boot floppies, for example,
   make bin32/eepro100.fd0

3.2 For DHCP request from kernel (B.4)
You need to compile your own LTSP client kernel.

3.2.1 Obtain the ltsp_initrd_kit package.

3.2.2 Obtain the kernel source and unpack it in say, /usr/src/linux. This is
independent of the preferred way to compile kernels in your distribution (like
say, buildpackage in Debian). Use the kernel config in the ltsp_initrd_kit as
follows.
   cp <ltsp_initrd_kit>/config-2.4.19-ltsp-1 /usr/src/linux/.config

Compile it. 
make dep && make clean && make bzImage && make modules && make modules_install

3.2.3 Modify the initrd (initial root FS for the client)
Edit the dhclient call in <ltsp_initrd_kit>/root/linuxrc.
   /bin/dhclient -p 1002 eth0 >/tmp/dhclient.out 2>&1

3.2.4 Build an LTSP kernel (this contains a root FS) by running
<ltsp_initrd_kit>/buildk. Answer the questions it asks, the defaults are fine
except for the path to the kernel source which in this case will be
/usr/src/linux. There shouldn't be any errors. Copy the kernel
(vmlinuz-2.4.19) to your LTS boot file, for example, to
/usr/lib/lts/vmlinuz-2.4.19 on the LTSP server.

Make sure that the kernel you just copied is the one you built. It has to be
the latest vmlinuz* file in the output of `ls -lrt`.

3.2.5 Change /etc/dhcpd.conf to use this kernel. For example,
    host ws003 {
       hardware ethernet     00:00:C0:B7:AD:4A;
       fixed-address         192.168.254.92;
       filename              "/usr/lib/lts/vmlinuz-2.4.19";
    }

3.2.6 Restart dhcpd (see #C.I.1) and boot up your client.

II. You can use the Windows DHCP server with some tweaking.
   1. Create the symlink /opt/ltsp/i386000 to point to /opt/ltsp/i386. This is
    because we've seen Windows DHCP servers zero-pad root path strings.
   2. Set the bootfile (option 17) and rootpath (67), options to the
    location of the kernel and the root path respectively.
   3. Restart the service.

III. Use the VCI options in ISC DHCP.
This is explained in http://www.etherboot.org/doc/html/userman-4.html#ss4.3
under the heading 'REQUIRE_VCI_ETHERBOOT'. That takes care of B.1. For B.4
(when the kernel makes the dhclient call), I don't know how this will work.
There is another posting about this in this mailing list which you can look for.

Thanks: Jim and the folks who wrote all this software!
--
bhaskar


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_____________________________________________________________________
Ltsp-discuss mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-discuss
For additional LTSP help,   try #ltsp channel on irc.openprojects.net

Reply via email to