TFTP and DHCP Server (dnsmasq)

dnsmasq is a light-weight server that combines DHCP, DNS and TFTP services in the same service. It thus distributes IP addresses to computers on the local network via the DHCP protocol, ensures that hostnames can be resolved by DNS, and that computers can boot from the network (to install new Ubuntu clients).

Making dnsmasq work

Actually, network-manager messes up dnsmasq, so we need to do this:

  1. edit /etc/NetworkManager/NetworkManager.conf file with you lovest editor
  2. comment the line dns=dnsmasq
  3. restart the network manager : sudo restart network-manager

See also: http://askubuntu.com/a/279539

/etc/dnsmasq.d/fair

dhcp-range=192.168.10.20,192.168.10.255,12h
listen-address=192.168.10.1
enable-tftp
tftp-root=/var/tftp
dhcp-boot=pxelinux.0
dhcp-option=3,192.168.10.1
dhcp-option=6,192.168.10.1
dhcp-option=42,192.168.10.1 # NTP server
interface=eth0

address=/intranet/192.168.10.1
address=/intranet.fair/192.168.10.1
address=/repository.fair/192.168.10.1
address=/#/192.168.10.1

Other resources

TFTP files

Fetch Ubuntu network boot image

The following commands shows the origin of the install program for computers which use network boot. The install program is a compressed filesystem which was downloaded from the main Ubuntu servers.

mkdir /var/tftp
cd /var/tftp/
wget http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-i386/current/images/netboot/netboot.tar.gz
tar zxf netboot.tar.gz
chown -R nobody: .
chmod -R 777 /var/tftp/

Configuring PXE Boot Menu

  • Ubuntu 10.04: '''/var/tftp/ubuntu-installer/i386/boot-screens/text.cfg'''
  • Ubuntu 10.10: '''/var/tftp/ubuntu-installer/i386/boot-screens/txt.cfg'''

This configuration file creates the menu that is shown at start-up on computers that boot from the network.

default local
timeout 10
label local
    menu label ^Boot from hard drive
    menu default
    localboot 0
label fair_http
    menu label ^Automatic Ubuntu Install
    kernel ubuntu-installer/i386/linux
    append vga=normal initrd=ubuntu-installer/i386/initrd.gz ks=http://192.168.10.1/ks.cfg ksdevice=eth0 -- quiet 
label install
    menu label ^Manual Ubuntu Install
    kernel ubuntu-installer/i386/linux
    append vga=788 initrd=ubuntu-installer/i386/initrd.gz -- quiet 
label cli
    menu label ^Command-line install
    kernel ubuntu-installer/i386/linux
    append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=788 initrd=ubuntu-installer/i386/initrd.gz -- quiet

Further PXE configuration

In '''pxelinux.cfg/default''', you can change '''timeout''' to a non-zero value to make the system automatically boot to hard drive after for instance 5 seconds!