Howto setup a isolated installation network with dnsmasq pxeboot and on Fedora 15

· by Tim Hughes · Read in about 3 min · (518 words)

Simple pxeboot environment on a Fedora 15 system. This is useful if machines you are trying to build are on a network that cannot see the internet. My particular case is a home server which I want to setup from a place that doesn’t have cabling. I will move it into the cupboard that does have cabling when done but for the time being it is more convenient to set it up on the desk in my bedroom. Unfortunately my bedroom doesn’t have network cabling so I need to create a few things for this to work. Since I am going to use my laptop as the installation server I will refer it as the ‘laptop’ and the machine I am going to install onto as the ‘server’

  • DHCP server - so that the computer booting can get an ipaddress
  • TFTP server - for the boot files
  • NFS server - for access to the mounted dvd filesystem

We start off my installing the packages we need and mounting the DVD in a place where we can serve the files from it.
 yum install dnsmasq syslinux-tftpboot nfs-utils

First we setup the NFS export, this is a simple as editing the /etc/exports file and adding the following line

/media/Fedora/??????/ 192.168.6.0/255.255.255.0(ro)

Start the NFS server and turn off your firewall (dont forget to turn it on again afterwards).

service nfs restart
service iptables stop

Next we need to setup the filesystem with the tftp boot configuration. Installing syslinux-tftpboot should have installed a heap of files under /tftpboot/. we need to create some directories under there and add in our config files plus the kernels that are going to be used for the install.

default menu.c32
timeout 100
prompt 0
MENU TITLE PXE Boot Menu

label local
        menu default
        menu label Boot from local disk
        localboot 0

label F15-manual
        menu label Fedora 15 Manual Installation
        kernel kernels/F15/vmlinuz
        append initrd=kernels/F15/initrd.img ramdisk_size=16000 repo=nfs:192.168.6.1:/media/Maxtor/repos/fedora/linux/releases/15/Fedora/x86_64/os/

Fedora 15 comes with dnsmasq which is a DHCP, DNS, TFTP server all in one. I am not going to use the DNS server  as we don’t need it. If it is not installed the do so using yum

yum install dnsmasq

We need to create a config file for dnsmasq that isn’t the one under  /etc as this is a one off thing and I don’t want to run a second DHCP server when the main server is rebuilt.

# DHCP Range
dhcp-range=192.168.6.50,192.168.6.250,12h

# Match a host
dhcp-host=192.168.6.60,,MACADDRESS,90d

# filename and  next-server
dhcp-boot=/pxelinux.0

enable-tftp
tftp-root=/tftpboot

You will need to change the MACADDRESS to match that of the machine you are installing. I have also chosen 192.168.6.0/24 for my network as I don’t use it for anything else, if this conflicts with you network feel free to chose something more appropriate. There are many more configuration variables for dnsmasq but this should be all we need. If you are interested in the other options see the man page, all the options are the same as the long options minus the – at the start.

Now add the interface on your laptop to the network you selected above, I usually choose 192.168.6.1.