There is more than one way to install Ubuntu via netboot, search for netboot in the Ubuntu wiki.
This guide aims to give simple, complete and verifiable instructions to get netboot working in a matter of minutes. They are for installing Ubuntu 8.04, but with minor modifications in step 2 they should work for other Ubuntu releases as well.
Before you begin
There should be no other DHCP servers running in the subnet. You might succeed with two servers as well (as I did), but be warned.
You might want to check if TFTP service is already enabled on your server, e.g. via inetd (/etc/inetd.conf; use update-inetd --disable tftp to turn off the inetd service).
DHCP/TFTP server installation
Prepare
- 0 become the root user
sudo -i
- install required software
apt-get install dnsmasq atftp
- download and unpack the netboot tarball
mkdir /tftpboot cd /tftpboot wget http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/netboot.tar.gz tar -zxf netboot.tar.gz chown -R nobody: .
tell dnsmasq to assign addresses starting from <BEGIN_IP_RANGE> until <END_IP_RANGE>, and to enable the TFTP service for BOOTP (PXE). The default gateway must be put in <DEFAULT_GW>, and the dns server in <DNS_SERVER> (both of these may be omitted if the host running dnsmasq is also the LAN's default gateway and DNS server). Append this to /etc/dnsmasq.conf with your favorite editor:
dhcp-range=<BEGIN_IP_RANGE>,<END_IP_RANGE>,12h enable-tftp tftp-root=/tftpboot dhcp-boot=pxelinux.0 dhcp-option=3,<DEFAULT_GW> dhcp-option=6,<DNS_SERVER>
An example append is shown here:
dhcp-range=192.168.0.20,192.168.0.30,12h enable-tftp tftp-root=/tftpboot dhcp-boot=pxelinux.0 dhcp-option=3,192.168.0.1 dhcp-option=6,192.168.0.1
Restart your computer.
Then restart dnsmasq with the following command:
service dnsmasq restart
- check that your firewall is not blocking DHCP/TFTP traffic (UDP) or, alternatively, just turn off the firewall altogether
iptables -F iptables -X iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -t mangle -F iptables -t mangle -X iptables -t nat -F iptables -t nat -X
- everything is ready to run now. Time to verify if everything really works.
Verify
check iptables, if you turned it off, there should be no rules and the policy should be ACCEPT
iptables-save
check if dnsmasq is listening on the bootp/DHCP port 67
ss -lnpu | grep ':67\b' # should display "UNCONN 0 0 *:67 *:* users:(("dnsmasq",pid,fd))"
check if dnsmasq is listening on the tftp port 69
ss -lnpu | grep ':69\b' # should display "UNCONN 0 0 *:69 *:* users:(("dnsmasq",pid,fd))"
- test if you can get the PXE boot kernel via tftp.
cd /tmp echo 'get pxelinux.0' | atftp localhost ls -l pxelinux.0 # should display a ~14kB file
Boot the client
Enable PXE boot in BIOS or use Ethertool or whatever makes your client boot off the net. See e.g. http://syslinux.zytor.com/pxe.php .
Problems?
check syslog (/var/log/syslog)
use ethereal (wireshark) to inspect network traffic