Netboot Installation

Installing Debian from a local network.

The scenario

You have a local network with a server and a client. You want install debian on the client by booting over the network using a kernel image stored on the server.

Installing DHCP server

The target computer needs to get its network information from DHCP. If you have another DHCP server running on the network, disable it for now.

On the server:

# apt-get install dnsmasq


Fill out these configuration options in /etc/dnsmasq.conf:

  • BEGIN_IP_RANGE: start of range of IPs to allocate to clients
  • END_IP_RANGE: end of range of IPs to allocate to clients
  • DEFAULT_GW: default gateway given to clients
  • DNS_SERVER: ip address of the dns server given to clients.

codetitle. /etc/dnsmasq.conf


For example:

codetitle. /etc/dnsmasq.conf


Run the dhcp server

sudo invoke-rc.d dnsmasq restart


Check if dnsmasq is listening on the bootps port 67:

sudo lsof -i :bootps

Also, remember to disable your firewall or allow port bootps.

dnsmasq also runs a dns server, which means you cannot be running another one for dnsmasq to start. To see that it is listening as a dns server:

sudo lsof -i :domain

Installing TFTP server

apt-get install atftp atftpd

The atftpd configuration (/etc/default/atftpd) by default uses the directory /var/lib/tftpboot. So, we create that directory:

sudo mkdir /var/lib/tftpboot
cd /var/lib/tftpboot

Put the netboot data in place.

sudo wget <<url for netboot.tar.gz>>
sudo tar zxf netboot.tar.gz
sudo chown -R nobody: .

Url for ubuntu and debian

disable inetd

Run tftpd as a daemon instead of from inetd:

sudo sed -e '/USE_INETD=/s/true/false/' -i /etc/default/atftpd
sudo invoke-rc.d inetd stop
sudo invoke-rc.d xinetd stop
sudo invoke-rc.d atftpd restart


Check the it is running and bound to port 69 (tftp)

sudo lsof -i :tftp

Attempt to connect and get boot image:

cd /tmp
echo 'get pxelinux.0' | atftp localhost
ls -l pxelinux.0

This should display a ~14k pxelinux.0 file. Replace ‘localhost’ with whatever host your tftpd is running on.

Old way

Figure out the MAC address of the computer you want to boot (host). Usually, this can be discovered in the bios. It goes on the line “hardware ethernet MAC_ADDRESS”.

This assume that you have set up as the network for DHCP and that is configured as a nameserver and is set up with ipmasq. This is not required: any valid default route will work.

codetitle. /etc/dhcpd.conf:

option domain-name "";
default-lease-time 600;
max-lease-time 7200;
allow booting;
allow bootp;

subnet netmask {
  filename "pxelinux.0";
  option subnet-mask;
  option broadcast-address;
  option routers;
  option domain-name-servers;

  host servername_to_boot {
    hardware ethernet 00:30:48:59:0B:C6;
    filename "pxelinux.0";
  • # /etc/init.d/dhcp restart

Download netboot kernel

For links to download netboot.tar.gz:

  1. mkdir /tftpboot
  2. cd /tftpboot
  3. wget <>
  4. tar xvzf netboot.tar.gz

Install TFTPd

# apt-get install atftpd

You could run the TFTP daemon from inetd or as a background daemon, but since we probably just want to do this once, it is best to run it on the command line and make it spit the logging messages out to the console:

atftpd --daemon --no-fork --tftpd-timeout 300 --retry-timeout 5 --mcast-port 1758 --mcast-addr --mcast-ttl 1 --maxthread 100 --verbose=7 --logfile /dev/stdout /tftpboot

Testing TFTP

# apt-get install atftp
> atftp localhost
tftp> get pxelinux.0