(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

  Next Previous Contents

4. Server side software

Before you proceed with installing the server-software, it would be beneficial to review the following HOWTO's (in the listed order):

Particularly, the Diskless-HOWTO contains a wealth of information useful for this project.

The required software are mostly already installed on a stock Linux distribution, but some might be missing. The ones that are usually not found (dhcpd, pxe, etc) are included in the mpeg-box-project.tgz file.

  • NFS server. Also called nfs-server or just nfs
  • TFTP server. Called tftpd.
  • DHCPd server. There are two versions. The latest one supports natively PXE extension (which my network card uses), but doesn't support menu based booting - something I needed during the development. I'm using v2.0 and for PXE extensions I'm using an DHCP proxy (all these strange terms will be explained later on).
  • DHCP Proxy server - PXE. Not needed if you are using the latest version of DHCP. The package is called pxe. Make sure you pick the latest one, or just use the one that's included in my file.

4.1 NFS server installation.

I presume you have read the NFS-HOWTO . If you haven't, do yourself a favor and pick it up. Most of these information are straight from that HOWTO.

Before you start setting NFS, make sure you have nfs-utils or nfs-server package installed. If you don't have them, the dhcpd-2.0pl2 source code is included in the mpeg-box-project.tgz file.

  • Extract the file -
    tar -zxvf mpeg-box-project.tgz
    
  • go into 1st Step - configuring server/01 - dhcpd.
    cd "1st Step - configuring server/01 - dhcp"
    
  • From there run:
    ./configure
    make
    make install
    

Setting up the server will be done in two steps: Setting up the configuration files for NFS, and then starting the NFS services.

Setting up the Configuration Files

There are three main configuration files you will need to edit to set up an NFS server: /etc/exports, /etc/hosts.allow, and /etc/hosts.deny. Strictly speaking, you only need to edit /etc/exports to get NFS to work, but you would be left with an extremely insecure setup. You may also need to edit your startup scripts.

/etc/exports

This file contains a list of entries; each entry indicates a volume that is shared and how it is shared. Check the man pages (man exports) for a complete description of all the setup options for the file, although the description here will probably satisfy most people's needs.

An entry in /etc/exports will typically look like this:

directory machine1(option11,option12) machine2(option21,option22)

where

directory

the directory that you want to share. It may be an entire volume though it need not be. If you share a directory, then all directories under it within the same file system will be shared as well. For example it might be: /exports

machine1 and machine2

client machines that will have access to the directory. The machines may be listed by their IP address or their DNS address (e.g., machine.company.com or 192.168.0.8). Using IP addresses is more reliable and more secure.

optionxx

the option listing for each machine will describe what kind of access that machine will have. Important options are:

  • ro: The directory is shared read only; the client machine will not be able to write to it. This is the default.
  • rw: The client machine will have read and write access to the directory.
  • and many more ...

For our MP3-box, we just need to read-only access to the directory with mp3's. Suppose the MP3-box IP will be 10.0.0.8 and the directory with our music files is /exports/media. The /etc/exports would look like this:

/exports/media     10.0.0.8(ro)

/etc/hosts.allow and /etc/hosts.deny

These two files specify which computers on the network can use services on your machine. Each line of the file is an entry listing a service and a set of machines. When the server gets a request from a machine, it does the following:

  • It first checks hosts.allow to see if the machine matches a description listed in there. If it does, then the machine is allowed access.
  • f the machine does not match an entry in hosts.allow, the server then checks hosts.deny to see if the client matches a listing in there. If it does then the machine is denied access.
  • If the client matches no listings in either file, then it is allowed access.

In general, it is a good idea with NFS (as with most internet services) to explicitly deny access to hosts that you don't need to allow access to.

The first step in doing this is to add the following entry to /etc/hosts.deny:

   portmap:ALL    

Next, we need to add an entry to hosts.allow to give any hosts access that we want to have access. (If we just leave the above lines in hosts.deny then nobody will have access to NFS.) Entries in hosts.allow follow the format:

    service: host [or network/netmask] , host [or network/netmask]           
Here, host is IP address of a potential client; it may be possible in some versions to use the DNS name of the host, but it is strongly deprecated.

Suppose we have the setup above and we just want to allow access to huh.com and arakis.dune.com, and suppose that the IP addresses of these machines are 10.0.0.8 and.10.0.0.1, respectively. We could add the following entry to /etc/hosts.allow:

   portmap: 10.0.0.8, 10.0.0.1
For recent nfs-utils versions, we would also add the following (again, these entries are harmless even if they are not supported):

    lockd:  10.0.0.8, 10.0.0.1                                       
    rquotad: 10.0.0.8, 10.0.0.1                                      
    mountd:  10.0.0.8, 10.0.0.1                                       
    statd:  10.0.0.8, 10.0.0.1                                       

Starting the NFS server.

The shell scripts which start the NFS server are usually in /etc/init.d or /etc/rc.d. Depending on your Linux distribution, you either need to run: netconfig, setup (RedHat) ; YaSt2(SuSe); turbo-config (TurboLinux); or you are stuck editing /etc/init.d/nfs-server files manually. If you run those programs, look for options that list NFS or nfs-serveR and start those services.

4.2 DHCPd server installation.

DHCP (Dynamic Host Configuration Protocol) is a protocol for computers to find out their IP address, gateway settings, netmask, and a lot more. Its a quite nice off-load for the system administrator. The reason why you want to use it is because when the MP3-box comes up, as said before, it doesn't have a harddrive, nor floppy drive - therefore it can't boot an operating system. But with a card that supports PXE, the following happens:

  • The network card starts sending a DHCP request to the network
  • The DHCP server offers a IP for the MP3-box.
  • The MP3-box gets the IP address and then procceds to send PXE extension DHCP request - an extension to the DHCP, which is not covered in the RFC.
  • The PXE extension daemon issues the NBP (Network Boot Program) to the card on the MP3-box.
  • The NBP contacts the TFTP server and downloads the Linux kernel, and the initrd.gz file. After that it runs the Linux kernel.
  • The Linux kernel does what it has been programmed to.
Without the IP address, the system wouldn't be able to get the NBP, neither the Linux kernel.

Setting up the DHCP daemon is a two stage process - installing the binaries, and setting up the configuration file for DHCP.

Installing DHCPd

The version of DHCP I'm using comes from Internet Software Consortium, the version is 2.0. You might already have the binaries installed, if that's the case - skip this section.

The source code is 1st Step - configuring server/01 - dhcpd/dhcp-2.0pl2, go into that directory and issue the following commands:

./configure
make
make install

The shell scripts which start the DHCP server are usually in /etc/init.d or /etc/rc.d. Depending on your Linux distribution, you either need to run: netconfig, setup (RedHat) ; YaSt2(SuSe); turbo-config (TurboLinux); or you are stuck editing /etc/init.d/dhcpd files manually.

Setting up the configuration files for DHCPd

The most important part of the /etc/dhcpd.conf file are the option fields and the host field. For the v2.0 of ISC-dhcpd its necessary to specify

option dhcp-class-identifier "PXEClient";
option vendor-encapsulated-options ff;
This will enable the DHCP server to recognize the network cards with PXE as valid. Make sure you also have the host section filled out. For example, for the MP3-box called swallow.eoh the host entry would look like:
host swallow {
        hardware ethernet 00:90:27:c1:dc:db;
        fixed-address swallow.eoh;
}

This is allow the DHCP server to give the box with that MAC address (which the network card displays during boot-up), the IP address associated with the host swallow. How is the host associated with 10.0.0.8 - that's the job of DNS server (which you hopefully have installed). If you don't have DNS, you can use flat-host resolution and add into /etc/hosts the following line (replace the 00:90:27. .. with your MAC address):

10.0.0.8       swallow.eoh    swallow

Back to the program ...

Following is my /etc/dhcpd.conf file:


option domain-name "eoh";
option dhcp-class-identifier "PXEClient";
option vendor-encapsulated-options ff;

option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;

subnet 10.0.0.0 netmask 255.255.255.0 {
        range 10.0.0.20 10.0.0.40;
}
host swallow {
        hardware ethernet 00:90:27:c1:dc:db;
        fixed-address swallow.eoh;
}

You can check your DHCP server by booting up a Windows workstation, and change its IP address to Obtain an IP address automatically.

4.3 PXE daemon

PXE is standard for remote booting. The following information is taken from 1st Step - configuring server/02 - pxe/pxe-README:

PXE is an extension to DHCP and also method of remotely booting. The specs for PXE can be found at ftp://download.intel.com/ial/wfm/pxespec.pdf. The PXE daemon provides two capabilities: proxyDHCP and PXE Bootserver. The PXE daemon can be set up to provide either or obth of the capabilities. Both capabilities are required.

proxyDHCP works in parallel with DHCP and provides the booting client with a remote boot configuration options. ProxyDHCP provides the PXE client(s) with the following information: remote boot prompt with optional timeout, remote boot menu and PXE Bootserver discovery options.

The PXE Bootserver is a capability provided by the PXE daemon. The PXE Bootserver is the capability that provides the booting client with boot images for a particular boot environment.

PXE Bootserver serves up requested NBPs (Network Boot Programs) to PXE clients. PXE Clients locate PXE Bootservers using discovery information provided to the client by proxyDHCP. The discovery method used by the PXE client (multicast, broadcast or unicast) and the list of available bootserver types is controlled by proxyDHCP. PXE Bootservers always listen for all three types of discovery requests and will respond to all valid requests.

Installing PXE software.

If you have RedHat or SuSE, pxe is available as an RPM - download it and install it. Unfortunately, you are still going to need the sources - you will have to recompile the NBP (Network Boot Program).

All the paths mentioned below refer to the contents of the mpeg-box-project.tgz file, which has all the source files and configuration files listed below.

The source file for PXE server are located in

1st Step - configuring server/02 - pxe/pxe/pxe-linux/server.

If you don't have PXE installed, just run: make and make install. The files will be installed in /usr/local. After that you should copy the 1st Step - configuring server/02 - pxe/pxe/pxe.init file to /etc/rc.d or /etc/init.d. After that go into your /etc/rc2.d and link /etc/init.d/pxe.init file to S99pxe. The command is:

ln -s ../init.d/pxe.init S99pxe
If you have no clue what I'm talking about, just enter
pxe
that will start the PXE daemon (but do that after you have read the next section)

Setting up the PXE daemon.

To get the PXE daemon completely working, its necessary to setup a couple of configuration files/directories.

  • pxe.conf which is located in 1st Step - configuring server/03 - etc files should be copied to /etc. The differences between this file and the one that comes with PXE software is small - the order of boot programs is changed. The original pxe.conf is located in 1st Step - configuring server/02 - pxe/pxe/pxe-linux/server/services.
  • mtftpd.conf which lists multicast addresses and the files associated with it. Its better to leave the file alone. Copy it from 1st Step - configuring server/03 - etc files into /etc directory.
  • The file /etc/inetd.conf needs to be modified so that it will include support for TFTP (in case MTFTP doesn't work) and MTFTP. The lines that should be added are:
    mtftp   dgram   udp     wait    root    /usr/sbin/tcpd in.mtftpd /tftpboot
    tftp    dgram   udp     wait    nobody  /usr/sbin/tcpd in.tftpd 
    
  • Add into /etc/services:
    mtftp           1759/udp
    pxe             67/udp
    pxe             4011/udp
    
    This will your life a little simpler when you are going to debug network problems.
  • The last thing will be to create the /tftpboot directory with all the files in it. Do the following command:
    mkdir -p /tftpboot/X86PC/UNDI/BStrap
    mkdir -p /tftpboot/X86PC/UNDI/linux-install
    
    The copy the bstrap.0 file (which is located in 1st Step - configuring server/02 - pxe/pxe/pxe-linux/server/services into /tftpboot/X86PC/UNDI/BStrap. Do the same thing for linux.0, but copy it into /tftpboot/X86PC/UNDI/linux-install. If you don't like any of these patchs, modify the /etc/pxe.conf, /etc/mtftpd.conf accordingly.

After all these steps, make sure you have a DHCP daemon running and working (look in the section about DHCP to find out how). Start the pxe daemon by typing

pxe
The debug information for PXE is piped into /PxeServiceLog.txt. To turn this debug-feature off, edit the /etc/pxe.conf - search for DebugOutToFile.

Turn on your system with a network card that supports PXE. You should see the card getting an IP from the DHCP server, and then showing up a menu. If that's the case, you have successfully configured the server system, and its time to get configure the Linux kernel and initrd file for the MP3-box in the next section.


Next Previous Contents