PXE boot FreeBSD

From FiberWiki

Jump to: navigation, search

This document is for current Fiber Hosting customers who have multiple servers. This tutorial is not going to go over how to install the services, but rather where to put the files and how to modify the configure files. This is netbooting FreeBSD 8.0 from a normal Linux server running 2.6.x kernel.

DHCP

We will want to add a PXE entry to /etc/dhcpd.conf, but first we need to allow booting:

allow booting;
allow bootp;

By adding the lines above into the top of your dhcpd configuration file you will be able to allow the server to look for dhcp information for tftp. Now we are going to add the entry for the server:

host bsd.fiber-hosting.com {
         hardware ethernet 00:11:22:33:44:55;
         fixed-address $STATIC_IP;
         option routers $GATEWAY_IP;
         next-server $PXE_SERVER;
         filename "pub/bsdlive/boot/pxeboot";
         option root-path "/home/tftpboot/pub/bsdlive";
}

$STATIC_IP = The IP address you want to assign the server. $GATEWAY_IP = The IP address of the gateway for your subnet (This was emailed to you with the first setup email). $PXE_SERVER = The IP address of your PXE server filename = The location of the pxeboot file provided by the iso. Remember tftp is running in chroot mode so you do not need to add /home/tftpboot or /tftpboot just start at the public folder you set. option root-path = the path that the bsd installer will take to receive the information over NFS

Now we want to restart dhcpd by issuing the following command:

service dhcpd restart

NFS

Next we need to allow the mount in NFS exports, which is located at /etc/exports:

/home/tftpboot/pub 207.126.x.x/255.255.255.x(rw,no_root_squash)

So if you have a whole C-class with us which is the 254 address, and your subnet is 207.126.166.0-254 your line would look like this

/home/tftpboot/pub 207.126.166.0/255.255.255.0(rw,no_root_squash)

Then issue the restart

service nfs restart

ISO

We will want to download the FreeBSD iso to our location tftp directory:

cd /home/tftpboot/pub
mkdir -p freebsd8_live
cd ..
mkdir -p ISO
cd ISO
wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/8.0/8.0-RELEASE-i386-livefs.iso
mkdir -p /media/bsd

Now we want to mount the iso:

mount -o loop -t iso9660 8.0-RELEASE-i386-livefs.iso /media/bsd/

Now we want to extract the content:

cp -R /media/bsd/* /home/tftpboot/pub/freebsd8_live

Now we need to unmount the ISO:

umount /media/bsd

Now we need to edit loader.conf located inside our bsd folder:

cd /home/tftpboot/pub/freebsd8_live
cd /boot
nano loader.conf

We need to add this on the very last line:

vfs.root.mountfrom="ufs:/dev/md0"

Now exit and save


Reboot the server and the PXE install will start!

Navigation