PXE: Network Booting Into Debian Setup

I just installed Debian on a 2002-ish desktop: Intel Celeron 1.7GHz, 256 SDRAM, 10 GB HDD, an aging floppy drive alongside a dodgy CD drive; just another you-wont-see-me-using-this-on-a-daily-basis desktop PC. I hostnamed it vindauga.

BIOS Setup

First of all, I have to make vindauga to look forward to booting from network. On BIOS I’ve set its boot order to LAN and then HDD, I also have to set it’s “On-board LAN” to “Enabled”.

Connect It To Network

Luckily, I already have a Debian server up and sharing its internet connection. This server is going to bootstrap the installation for vindauga.

The thing about booting from network, is to make vindauga to join my network. Luckily I already run a dhcp server (package name: isc-dhcp-server) on my Debian server, this is my setup:

# this is an excerpt from my /etc/dhcp/dhcpd.conf
subnet 192.168.77.224 netmask 255.255.255.248 {
    # this subnet is for wired LAN at eth2
    range 192.168.77.226 192.168.77.230;

    option subnet-mask          255.255.255.248;
    # broadcast address to nodes in this subnet
    option broadcast-address    192.168.77.231;

    # set resolver & gateway to this computer/my Debian-server (192.168.77.225)
    option domain-name-servers  192.168.77.225;
    option routers              192.168.77.225;

    host VINDAUGA { # assign fixed IP address for vindauga for now
        hardware ethernet       00:E0:4C:99:DF:E7;
        fixed-address           192.168.77.226;
    }

    # this is the most important of all; with this, dhcp server will provide
    # NOT ONLY network details (address, gateway, etc.) but also a bootstrap
    # program for vindauga to run
    filename "pxelinux.0";
}

The filename "pxelinux.0"; part is to make vindauga to expect a program named pxelinux.0 for booting. As you might already know a dhcp server does not transfer file, basically it just giving the client a hint about the file, the one who actually transfer that file over the wire is another program called tftp-hpa, basically it is a simplified-ftp server. In Debian you can find its package named as “tftpd-hpa“.

Get tftp-hpa To Deliver

This tftp-hpa program —by default— uses UDP on port 69 so I punched a hole in my firewall to allow this traffic.

Now, its configuration file:

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="192.168.77.225:69"
TFTP_OPTIONS="-v -s"

As you can see, on TFTP_ADDRESS I set it to listen on 192.168.77.255 port 69. This is the IP address on my Debian server for eth1, which is connected to vindauga. The TFTP_OPTIONS is to make tftp-hpa to be verbose (the “-v” part), and to serve on a specific root (the “-s”).

The “-s” part is significant because it allows the dhcp server to say just pxelinux.0 and tftp-hpa would resolve it as /srv/tftp/pxelinux.0.

What To Deliver

This (highly-anticipated :)) pxelinux.0 file can be found in the netboot distribution of Debian:

http://kambing.ui.ac.id/debian/dists/stable/main/installer-i386/current/images/netboot/

Since I’m in Indonesia it is the fitting Debian mirror for me, feel free to use another mirror.

I download pxelinux.0, all files under debian-installer/ and pxelinux.cfg/ directory and put them in /srv/tftp/. I skipped the debian-installer/i386/pxelinux.0 because its a symlink to pxelinux.0 and end up with this:

/srv/tftp/
├── pxelinux.cfg
│   └── default
├── pxelinux.0
└── debian-installer
    └── i386
        ├── linux
        ├── initrd.gz
        └── boot-screens
            ├── xfce
            │   ├── txtdt.cfg
            │   ├── txt.cfg
            │   ├── prompt.cfg
            │   ├── prmenu.cfg
            │   ├── menu.cfg
            │   ├── adtxtdt.cfg
            │   └── adtxt.cfg
            ├── vesamenu.c32
            ├── txt.cfg
            ├── syslinux.cfg
            ├── stdmenu.cfg
            ├── splash.png
            ├── rqtxt.cfg
            ├── prompt.cfg
            ├── menu.cfg
            ├── lxde
            │   ├── txtdt.cfg
            │   ├── txt.cfg
            │   ├── prompt.cfg
            │   ├── prmenu.cfg
            │   ├── menu.cfg
            │   ├── adtxtdt.cfg
            │   └── adtxt.cfg
            ├── kde
            │   ├── txtdt.cfg
            │   ├── txt.cfg
            │   ├── prompt.cfg
            │   ├── prmenu.cfg
            │   ├── menu.cfg
            │   ├── adtxtdt.cfg
            │   └── adtxt.cfg
            ├── f9.txt
            ├── f8.txt
            ├── f7.txt
            ├── f6.txt
            ├── f5.txt
            ├── f4.txt
            ├── f3.txt
            ├── f2.txt
            ├── f1.txt
            ├── f10.txt
            ├── exithelp.cfg
            ├── dtmenu.cfg
            └── adtxt.cfg

Boot It Up

I restart my dhcp server to make configuration changes into effect and start tftpd-hpa on my Debian server:

$ sudo /etc/init.d/isc-dhcp-server restart
$ sudo /etc/init.d/tftpd-hpa start

I turn on vindauga and lo, it boot into Debian’s setup menu.

Advertisements

Leave a comment

Filed under Ilmu, Orang bego punya kegiatan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s