Freebsd network booting

Doug Ambrisko (?) – 16 October 1999
Jason Andresen – April 4, 2005

These are some notes on Freebsd network booting with Etherboot.

Add kernel configuration via bootp to kernel. You can see more options in LINT, these are a good set

  # Kernel BOOTP support
  options         BOOTP           # Use BOOTP to obtain IP address/hostname
  options         BOOTP_NFSROOT   # NFS mount root filesystem using BOOTP info
  options         BOOTP_NFSV3     # Use NFS v3 to NFS mount root
  options         BOOTP_COMPAT    # Workaround for broken bootp daemons.

For FreeBSD? 5 and later, you will need to add in the hints statically. Even if your machine doesn't have ISA ports, some devices (like the keyboard) still need this information.

  hints            "GENERIC.hints"  # Compile hints into the kernel statically

However, FreeBSD 5 is problematic with Etherboot. At the moment I reccomend sticking with FreeBSD 4 until the kinks are worked out.

Setup Bootp server or DHCP server, here is an example entry for /etc/bootptab (long line broken into multiple lines for this example) refer to the man page bootpd for more information.

  .default: 
    :sm=255.255.255.0: 
    :gw=your.gateway.ip: 
    :hn:ht=ether:vm=rfc1048: 
    :rp="rootfs.ip:/rootfs/path": 
    :T128="swapfs.ip:/swapfs/path": 
    :T129=swapsize: 
    :T130="root,mount,options": 
    :T131="swap,mount,options": 
    :ra=255.255.255.255:

  client01:bf="kernel":ha=00400530d6d9:tc=.default:

Enable bootpd in inetd by uncommented the “bootps” line.

Alternately, you can configure isc-dhcpd. You will need to install it first (it is in the ports tree: net/isc-dhcpd-server). Once it is configured and running, add an entry like the following to your /usr/local/etc/dhcpd.conf):

 host netboothost { 
    hardware ethernet xx:xx:xx:xx:xx:xx;
    filename "bootkernel.img";
    fixed-address "testmachine.test.com";
    option root-path "192.168.0.1:/netbootroot";

 } 

Setup tftpd, copy your kernel into you tftpboot directory. Note you should make the kernel accessible in both the rootfs and the tftpboot area.

Enable tftpd by uncommenting tftp in /etc/inetd.conf. If you give the full kernel path then remove the /tftpboot directory option in inetd.conf. Again for more information look at man tftpd.

Send a SIGHUP to the inetd process.

Make sure you export the rootfs, in /etc/exports and SIGHUP mountd if needed. Refer to the man page mountd for more information.

You will probably want a line similar to:

 /netbootroot -network 192.168.0.0 -mask 255.255.255.0 

The swapfile if specified will need to be created. Just do a “dd” of /dev/zero for the size you want into the path specified in the bootptab with the IP address appended for example:

        /usr/exports/swap/swap.192.168.1.1

Now you should be ready to boot diskless. Note there are some useful boot time configuration file in /etc/rc.diskless.

A quick primer on rc.diskless:

rc.diskless assumes that your root partition is mounted read-only (a safe assumption). In order to keep the system operating normally, it creates several memory disks for directories that need to be read/write. This includes /tmp, /dev, and /var.

Additionally, most people need to create a mounted /etc. To do this, create the directory /conf/base/etc and populate it with the contents of the /etc. This will tell the diskless script to create a memory disk for /etc and populate it with the contest of /conf/base/etc. If you want to override particular files in /etc on certain machines, you can create directores like /conf/192.168.1.2/etc and populate it with whatever files you want to override on 192.168.1.2. You can also do this with entire subnets by creating the directory with the machine's broadcast address instead of its host address.

Note that changes made to a running diskless system (like changing your password) will not be reflected in the /conf files and will be lost on reboot. Additionally, all files in /tmp and /var will be lost (including any mail on a default install!)

Note2 NFS mount of root was broken in current it has been fixed.


QR Code
QR Code freebsd (generated for current page)