Wink Saville’s Blog

March 3, 2008

PXE - Booting via network cards

Filed under: linux, programming, pxe — wink @ 2:08 pm

To get PXE there are several resources on the web, here and here. The sources for pxelinux.0 is in syslinux. Anyway, here’s what I did; First, to use PXE you need to have a more capable DHCP server, so I switched to dhcpd3-server on my linux:

wink@saville-server:/etc/dhcp3$ cat my-dhcpd.conf
ddns-update-style interim;
option domain-name "saville.com";
option domain-name-servers 68.87.76.178, 66.240.49.9;
default-lease-time 600;max-lease-time 7200;

log-facility local7;
subnet 192.168.0.0 netmask 255.255.255.0 {
   range 192.168.0.100 192.168.0.149;
   option routers 192.168.0.2;
}

host test1 {
   hardware ethernet 00:1D:7D:00:A3:0B;
   fixed-address 192.168.0.148;
   option host-name "test1";
   filename "pxelinux.0";
   next-server 192.168.0.99;
}

The “host” section is the important part for PXE and in particular “hardware” identifies the card via its ethernet id, “filename” defines the file that will be requested and “next-server” defines the IP address of the server that will server the file to the “test1″ client via tftp.

So the next step was to get tftp working, I did the following but obviously synaptic works also:

apt-get install tftpd-hpa

I the config file for tftpd needs a little doctoring. The defaults is not running as a daemon and the directory is /var/log/tftpboot. You need it to run as a daemon and you may want to change the directory, here is what I have:

#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /tftpboot"

To start/test manually run “sudo /etc/init.d/tftpd-hpa start”. You should be able to see tftp using netstat:

wink@ic2d1:$ netstat netstat -apu
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp        0      0 *:32769                 *:*                                -
udp        0      0 *:32772                 *:*                                -
udp        0      0 ic2d1.local:netbios-ns  *:*                                -
udp        0      0 *:netbios-ns            *:*                                -
udp        0      0 ic2d1.local:netbios-dgm *:*                                -
udp        0      0 *:netbios-dgm           *:*                                -
udp        0      0 *:946                   *:*                                -
udp        0      0 *:tftp                  *:*                                -       
udp        0      0 *:mdns                  *:*                                -
udp        0      0 *:sunrpc                *:*                                -
udp        0      0 ic2d1.local:ntp         *:*                                -
udp        0      0 localhost:ntp           *:*                                -
udp        0      0 *:ntp                   *:*                                -
udp6       0      0 fe80::217:31ff:fee1:ntp *:*                                -
udp6       0      0 ip6-localhost:ntp       *:*                                -
udp6       0      0 *:ntp                   *:*                                -

You should now be able to add files to the directory /tftpboot such as pxelinux.0.

Powered by WordPress