Preface 

While the Citrix XenClient 1.0 Service Pack1  Users Guide covers the network install part over a Preboot eXecution Environment (PXE), it’s assuming that this is already in place. There’s an article in the Citrix knowledge center on this topic but covers a Windows environment only.  This is basically leveraging Windows Server DHCP and the Citrix Provisioning Services. When I started to prepare the Synergy Learning Lab I needed to create such an environment. Due to the fact I anyway carry a Linux VM which runs all possible infrastructure services (and needs almost no resources ), I just added these services/configurations to that VM. And finally, why not sharing the experience…. 


Required Services 
 
The basic services and  files required for a PXE based network install of XenClient

  • DHCP Environment
  • TFTP Server
  • FTP Server (or HTTP)
  • pxelinux.0 (boot file)
  • XenClient install media / ISO file

I’m using Debian Lenny as my preferred OS, but the setup is quit similar for many distros and quit a few popular such as Ubuntu are based on Debian.
 
The installation is straight forward.

Install DHCP Server:

synsrv:~# apt-get install dhcp3-server
Reading <span class="code-keyword">package</span> lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libmd5-perl
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  dhcp3-client dhcp3-common
Suggested packages:
  resolvconf avahi-autoipd dhcp3-server-ldap
The following NEW packages will be installed:
  dhcp3-server
The following packages will be upgraded:
  dhcp3-client dhcp3-common
2 upgraded, 1 newly installed, 0 to remove and 163 not upgraded.
Need to get 848kB of archives.
After <span class="code-keyword">this</span> operation, 786kB of additional disk space will be used.
Do you want to <span class="code-keyword">continue</span> [Y/n]? y
Get:1 http:<span class="code-comment">//security.debian.org lenny/updates/main dhcp3-client 3.1.1-6+lenny5                            [225kB]
</span>Get:2 http:<span class="code-comment">//security.debian.org lenny/updates/main dhcp3-common 3.1.1-6+lenny5                            [291kB]
</span>Get:3 http:<span class="code-comment">//security.debian.org lenny/updates/main dhcp3-server 3.1.1-6+lenny5                            [332kB]
</span>Fetched 848kB in 0s (1270kB/s)
Preconfiguring packages ...
(Reading database ... 113805 files and directories currently installed.)
Preparing to replace dhcp3-client 3.1.1-6+lenny4 (using .../dhcp3-client_3.1.1-6                           +lenny5_i386.deb) ...
Unpacking replacement dhcp3-client ...
Preparing to replace dhcp3-common 3.1.1-6+lenny4 (using .../dhcp3-common_3.1.1-6                           +lenny5_i386.deb) ...
Unpacking replacement dhcp3-common ...
Selecting previously deselected <span class="code-keyword">package</span> dhcp3-server.
Unpacking dhcp3-server (from .../dhcp3-server_3.1.1-6+lenny5_i386.deb) ...
Processing triggers <span class="code-keyword">for</span> man-db ...
Setting up dhcp3-common (3.1.1-6+lenny5) ...
Setting up dhcp3-client (3.1.1-6+lenny5) ...
Setting up dhcp3-server (3.1.1-6+lenny5) ...
Starting DHCP server: dhcpd3. 


Install TFTP Server:

synsrv:~# apt-get install tftpd-hpa
Reading <span class="code-keyword">package</span> lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libmd5-perl
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  tftpd-hpa
0 upgraded, 1 newly installed, 0 to remove and 163 not upgraded.
Need to get 34.6kB of archives.
After <span class="code-keyword">this</span> operation, 98.3kB of additional disk space will be used.
Get:1 http:<span class="code-comment">//ftp.ch.debian.org lenny/main tftpd-hpa 0.48-2.3 [34.6kB]
</span>Fetched 34.6kB in 0s (176kB/s)
Preconfiguring packages ...
Selecting previously deselected <span class="code-keyword">package</span> tftpd-hpa.
(Reading database ... 113807 files and directories currently installed.)
Unpacking tftpd-hpa (from .../tftpd-hpa_0.48-2.3_i386.deb) ...
Processing triggers <span class="code-keyword">for</span> man-db ...
Setting up tftpd-hpa (0.48-2.3) ...
Starting HPA's tftpd: in.tftpd.


Install FTP Server:

synsrv:~# apt-get install proftpd
Reading <span class="code-keyword">package</span> lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libmd5-perl
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  proftpd
0 upgraded, 1 newly installed, 0 to remove and 162 not upgraded.
Need to get 195kB of archives.
After <span class="code-keyword">this</span> operation, 233kB of additional disk space will be used.
Get:1 http:<span class="code-comment">//security.debian.org lenny/updates/main proftpd 1.3.1-17lenny6 [195kB]
</span>Fetched 195kB in 0s (570kB/s)
Selecting previously deselected <span class="code-keyword">package</span> proftpd.
(Reading database ... 113813 files and directories currently installed.)
Unpacking proftpd (from .../proftpd_1.3.1-17lenny6_all.deb) ...
Setting up proftpd (1.3.1-17lenny6) ...


Install syslinux (for pxelinux.0):

synsrv:~# apt-get install syslinux
Reading <span class="code-keyword">package</span> lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libmd5-perl
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  syslinux
0 upgraded, 1 newly installed, 0 to remove and 162 not upgraded.
Need to get 0B/62.5kB of archives.
After <span class="code-keyword">this</span> operation, 139kB of additional disk space will be used.
Selecting previously deselected <span class="code-keyword">package</span> syslinux.
(Reading database ... 113808 files and directories currently installed.)
Unpacking syslinux (from .../syslinux_2%3a3.71+dfsg-5_i386.deb) ...
Processing triggers <span class="code-keyword">for</span> man-db ...
Setting up syslinux (2:3.71+dfsg-5) ...


Make the XenClient installation media available:

This is not really an install, but we need grant access to the packages from the installer media. To keep that simple just copy the installer ISO to e.g. /root and mount the iso file.

synsrv:~# mount -o loop /root/XenClient_1_0_installer.iso /mnt
synsrv:~# ls -la /mnt
total 28
drwxr-xr-x  5 walterh walterh  2048 2010-09-28 12:49 .
drwxr-xr-x 21 root    root     4096 2010-04-02 11:08 ..
drwxr-xr-x  2 walterh walterh  2048 2010-09-28 12:49 isolinux
drwxr-xr-x  2 walterh walterh  2048 2010-09-28 12:49 packages.main
drwxr-xr-x  2 walterh walterh  2048 2010-09-28 12:49 usb_inst
-rwxr-xr-x  1 walterh walterh 15391 2010-09-28 12:49 usb_inst.sh

We’ll need some files from the isolinux for booting and the packages.main directory for the installation.




Configuring the services  

While I enjoy the beauty and speed of a command line, on most systems I just install Webmin, so I can configure most of the system and services by a nice web frontend.

 

 





DHCP Server configuration:

If you’re running a DHCP server already on Windows you need to add dhcp option 66/67 to the dhcp configuration for the scope. This specifies the bootserver (tftp server) and the bootfile (pxelinux.0).






On a Linux dhcp3-server you just add the two corresponding lines to the /etc/dhcp3/dhcpd.conf file.

option domain-name-servers 192.168.1.50, 192.168.1.1;
<span class="code-keyword">default</span>-lease-time 86400;
max-lease-time 604800;
authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.70 192.168.1.100;
        filename <span class="code-quote">"pxelinux.0"</span>;
        next-server 192.168.1.58;
        option subnet-mask 255.255.255.0;
        option broadcast-address 192.168.1.255;
        option routers 192.168.1.1;
}

If you’re using dnsmasq you would add the configuration into the /etc/dnsmasq.conf file.

dhcp-boot=pxelinux.0,synsrv,192.168.1.58


TFTP Server configuration:

Maybe worth to check that the TFTP server is enabled by checking that the RUN_DAEMON is set to “yes” in the /etc/default/tftpd-hpa file.

synsrv:~# more /etc/<span class="code-keyword">default</span>/tftpd-hpa
#Defaults <span class="code-keyword">for</span> tftpd-hpa
RUN_DAEMON=<span class="code-quote">"yes"</span>
OPTIONS=<span class="code-quote">"-l -s /<span class="code-keyword">var</span>/lib/tftpboot"</span>

Now create the tftp root directory, if not existing and start the server.

synsrv:~# mkdir -p /<span class="code-keyword">var</span>/lib/tftpboot
synsrv:~# /etc/init.d/tftpd-hpa start
Starting HPA's tftpd: in.tftpd.


FTP Server configuration:

Proftp is the primary choice for Linux FTP servers. By default proftp wouldn’t serve anonymous access, what we really want for an easy access to the XenClient install files.

To enable anonymous access you have to add or uncomment the respective lines in the /etc/proftpd/proftpd.conf. The home directory for the anonymous ftp user will be /home/ftp

&lt;Anonymous /home/ftp&gt;
  # After anonymous login, daemon runs as user/group ftp.
  User ftp
  Group ftp

  # The client login 'anonymous' is aliased to the <span class="code-quote">"real"</span> user 'ftp'.
  UserAlias anonymous ftp

  # Deny write operations to all directories, except <span class="code-keyword">for</span> 'incoming' where
  # 'STOR' is allowed (but 'READ' operations are prohibited)

  &lt;Directory *&gt;
    &lt;Limit WRITE&gt;
      DenyAll
    &lt;/Limit&gt;
  &lt;/Directory&gt;

  &lt;Directory incoming&gt;
    &lt;Limit READ &gt;
      DenyAll
    &lt;/Limit&gt;
    &lt;Limit STOR&gt;
      AllowAll
    &lt;/Limit&gt;
  &lt;/Directory&gt;

&lt;/Anonymous&gt;

After applying the changes, restart the proftp daemon.

synsrv:~# /etc/init.d/proftpd  restart
Stopping ftp server: proftpd.
Starting ftp server: proftpd.
synsrv:~#




Configuring the XenClient network installation

The first thing your computer will do when PXE booting is requesting a IP by sending a DHCP Discover as broadcast on the subnet. When everything is configured properly the DHCP Offer from you DHCP server will include information about your bootserver and bootfilename.

Consequently we need to make sure all required files for the kernel boot are found in the TFTP root directory, which is /var/lib/tftpboot.

You need to copy the content of the directory isolinux from the XenClient install media to the  TFTP root. We need at least the following files:

  • bootmsg.txt
  • mboot.c32
  • vmlinuz
  • xen.gz
  • rootfs.gz

The mboot.c32 is a comboot module for Syslinux that loads images using the Multiboot protocol. The bootmsg.txt is typically version/copyright information e.g. from the vendor and the remaining ones are kernel xen modules and root fielsystem which is being booted.

Additionally we need to copy the pxelinux.0 file to the TFTP root from the syslinux package we installed previously. This is being found in /usr/lib/syslinux.

synsrv:~# cp /usr/lib/syslinux/pxelinux.0 /<span class="code-keyword">var</span>/lib/tftpboot
synsrv:~#

When a computer is booted form the network, got the bootserver / bootfile information, the pxelinux.0 file will be downloaded using tftp. PXELINUX is a SYSLINUX derivative, for booting Linux from a network server using a network ROM conforming to the Intel PXE (Pre-Execution Environment) specification.

In the next step of the network boot a PXE configuration file will be searched for. It will look for a file in the tftproot/pxelinux.cfg directory. First it will look for file which represents the own Ethernet datalink address, then it will translate the own IP adrees into HEX and search for these strings and when not found removing one HEX digit and search again. this would result in a search for these files:

pxelinux.cfg/01-00-14-22-a1-53-85
pxelinux.cfg/C0A80146
pxelinux.cfg/C0A8014
pxelinux.cfg/C0A801
pxelinux.cfg/C0A80
pxelinux.cfg/C0A8
pxelinux.cfg/C0A
pxelinux.cfg/C0
pxelinux.cfg/C
pxelinux.cfg/default

This would mean, that you at least need to create the file  /var/lib/tftpboot/pxelinux.cfg/default. For my labs I actually created multiple files to balance the load on the two FTP servers I used.

This is a sample file I used:

<span class="code-keyword">default</span> xc-synergy
label xc-synergy
DISPLAY bootmsg.txt
kernel mboot.c32
append xen.gz console=com1,vga max_dom0_vcpus=1 com1=115200/921600,8n1,magic --- vmlinuz quiet console=xencons root=/dev/ram rw start_install answerfile=tftp:<span class="code-comment">//192.168.1.58/answerfile.who --- rootfs.gz
</span> 

So, you see that after displaying the bootmsg.txt, it will load mboot.c32 as kernel and uses the append for loading xen and vmlinux as well as specifies the rootfilesystem. This has all to be on a single line.

Note: On the very end of the line I’ve specified the answerfile which will be used for the XenClient installation. This file is being downloaded using TFTP from our TFTP root directory.

This is the content of my /var/lob/tftpboot/answerfile.who.  

&lt;interactive&gt;<span class="code-keyword">true</span>&lt;/interactive&gt;
&lt;mode&gt;fresh&lt;/mode&gt;
&lt;source type=<span class="code-quote">"url"</span>&gt;ftp:<span class="code-comment">//192.168.1.58/&lt;/source&gt;
</span>&lt;primary-disk&gt;sda&lt;/primary-disk&gt;
&lt;network-<span class="code-keyword">interface</span> mode=<span class="code-quote">"dhcp"</span>&gt;&lt;/network-<span class="code-keyword">interface</span>&gt;
&lt;enable-ssh&gt;<span class="code-keyword">true</span>&lt;/enable-ssh&gt;
&lt;license-key&gt;&lt;/license-key&gt;

The main settings I entered are:

  • interactive -> The user is able to choose various options 
  • mode -> Fresh install versus upgrade
  • Source type -> The URL (FTP) the install files will be downloaded from

This really represents a minimum configuration, much more options can be set including:

  • Primary Disk
  • Partion Mode
  • MBR options
  • Network Config
  • Keyboard language
  • Password (Dom0)

You even can specify to download a pre-created virtual hard drive and deploy a virtual machine, but that’s a topic for a future blog .

If you look to the source tag in the answer file, you noticed that the installation source if our FTP server, so the only remaining step is to copy the packages.main directory from the install media (remember, we mounted the iso on/mnt) to /home/ftp.

That’s it!

Boot your computer from network and after a while you’ll see the “welcome” screen of the XenClient installer.



Troubleshooting

I have to admit, I was struggling when I started with PXE boot environment, because of a corrupt pxelinux.0 file. I found that out by trying to replicate the while thing on my Windows (AD/DHCP/PVS) infrastructure and realized that this is behaving exactly the same way…

Generally speaking, Wireshark is your best friend!

I always keep some of my good old Ethernet HUB’s so I can tap into my connection and sniff the heck out of the cable. You can so easily follow what’s being requested and  how the server responding and where it brakes.

      6 1.753199    0.0.0.0               255.255.255.255       DHCP     DHCP Discover - Transaction ID 0x83b461f0
      7 1.753706    192.168.1.50          255.255.255.255       DHCP     DHCP Offer    - Transaction ID 0x83b461f0
      8 5.762734    0.0.0.0               255.255.255.255       DHCP     DHCP Request  - Transaction ID 0x83b461f0
      9 5.763224    192.168.1.50          255.255.255.255       DHCP     DHCP ACK      - Transaction ID 0x83b461f0 
Frame 7: 371 bytes on wire (2968 bits), 371 bytes captured (2968 bits)
Ethernet II, Src: 06:51:d4:d5:d7:64 (06:51:d4:d5:d7:64), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol, Src: 192.168.1.50 (192.168.1.50), Dst: 255.255.255.255 (255.255.255.255)
User Datagram Protocol, Src Port: bootps (67), Dst Port: bootpc (68)
Bootstrap Protocol
    Message type: Boot Reply (2)
    Hardware type: Ethernet
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0x83b461f0
    Seconds elapsed: 0
    Bootp flags: 0x0000 (Unicast)
        0... .... .... .... = Broadcast flag: Unicast
        .000 0000 0000 0000 = Reserved flags: 0x0000
    Client IP address: 0.0.0.0 (0.0.0.0)
    Your (client) IP address: 192.168.1.132 (192.168.1.132)
    Next server IP address: 192.168.1.58 (192.168.1.58)
    Relay agent IP address: 0.0.0.0 (0.0.0.0)
    Client MAC address: HewlettP_b4:61:f0 (00:24:81:b4:61:f0)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name: pxelinux.0
    Magic cookie: DHCP
    Option: (t=53,l=1) DHCP Message Type = DHCP Offer
    Option: (t=1,l=4) Subnet Mask = 255.255.255.0
    Option: (t=58,l=4) Renewal Time Value = 4 days
    Option: (t=59,l=4) Rebinding Time Value = 7 days
    Option: (t=51,l=4) IP Address Lease Time = 8 days
    Option: (t=54,l=4) DHCP Server Identifier = 192.168.1.50
    Option: (t=3,l=4) Router = 192.168.1.1
    Option: (t=6,l=8) Domain Name Server
    Option: (t=15,l=9) Domain Name = <span class="code-quote">"xd.local"</span>
    Option: (t=66,l=13) TFTP Server Name = <span class="code-quote">"192.168.1.58"</span>
    Option: (t=67,l=11) Bootfile name = <span class="code-quote">"pxelinux.0"</span>
    End Option
 
 No.     Time        Source                Destination           Protocol Info
     15 5.764786    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.0\000, Transfer type: octet\000
     16 5.765587    192.168.1.58          192.168.1.132         TFTP     Option Acknowledgement
     17 5.765615    192.168.1.132         192.168.1.58          TFTP     Acknowledgement, Block: 0
     38 5.818205    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/45def89d-6c11-de11-9005-22d25900006b\000, Transfer type: octet\000
     39 5.819084    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     40 5.819169    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/01-00-24-81-b4-61-f0\000, Transfer type: octet\000
     41 5.819927    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     42 5.819996    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/C0A80184\000, Transfer type: octet\000
     43 5.820751    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     44 5.820825    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/C0A8018\000, Transfer type: octet\000
     45 5.821575    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     46 5.822534    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/C0A801\000, Transfer type: octet\000
     47 5.823306    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     48 5.824271    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/C0A80\000, Transfer type: octet\000
     49 5.825034    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     50 5.825990    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/C0A8\000, Transfer type: octet\000
     51 5.826782    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     52 5.827740    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/C0A\000, Transfer type: octet\000
     53 5.828525    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     54 5.829483    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/C0\000, Transfer type: octet\000
     55 5.830248    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     56 5.831206    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/C\000, Transfer type: octet\000
     57 5.831973    192.168.1.58          192.168.1.132         TFTP     Error Code, Code: File not found, Message: File not found\000
     58 5.832938    192.168.1.132         192.168.1.58          TFTP     Read Request, File: pxelinux.cfg/<span class="code-keyword">default</span>\000, Transfer type: octet\000
     59 5.833715    192.168.1.58          192.168.1.132         TFTP     Option Acknowledgement
     60 5.833737    192.168.1.132         192.168.1.58          TFTP     Acknowledgement, Block: 0
     61 5.833940    192.168.1.58          192.168.1.132         TFTP     Data Packet, Block: 1 (last)
     62 5.833969    192.168.1.132         192.168.1.58          TFTP     Acknowledgement, Block: 1
     63 5.833992    192.168.1.132         192.168.1.58          TFTP     Read Request, File: mboot.c32\000, Transfer type: octet\000
     64 5.834751    192.168.1.58          192.168.1.132         TFTP     Option Acknowledgement
     65 5.834790    192.168.1.132         192.168.1.58          TFTP     Acknowledgement, Block: 0
     66 5.835200    192.168.1.58          192.168.1.132         TFTP     Data Packet, Block: 1
     67 5.835211    192.168.1.132         192.168.1.58          TFTP     Acknowledgement, Block: 1

And on and on… It’s like reading a book, but more logical than most of the books I know

Enjoy your XenClient network install and if you not already signed up for Synergy, may worth to consider. From what I’ve understood, my learning lab is sold out, but there’s always a chance to apply for a standby seat and/or just meet and talk outside the schedule. 

http://www.citrixsynergy.com/sanfrancisco/?sourceID=walterh-rts

ENJOY your work with XenClient and please note: We appreciate your feedback, please respond to this blog or use the XenClient forums for any XenClient related discussion.

Sincerely, Walter