Skip to content
Bootstrap for testing PXE boot configs in VirtualBox
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
TFTP add ubuntu xenial to available installers Jan 9, 2017
README.md make it so Mar 3, 2016

README.md

VirtualBox + PXE Boot + Kickstart example

VirtualBox support PXE (network booting) out of the box with minimal configuration and no extra software or servers.

This repo contains some basic starter files you can use to bootstrap your VirtualBox PXE boot setup faster.

Requirements

  • VirtualBox is installed and works
  • Create a VM you will use to test the PXE boot setup

VM Settings

In order for PXE booting to work with the builtin server in Virtualbox you need to configure your VM's network settings and boot order properly.

  • Set the VM to use the NAT networking (Network -> Adapter 1 -> Attached to: NAT).

  • Set the VM to boot from network (System -> Motherboard -> Boot Order). Alternatively, you can use F12 in the booting VM to load the boot menu. For testing PXE and kickstart configs, I found that changing the boot order was easier.

Setup PXE boot files

Unfortunately VirtualBox does not provide any PXE boot configuration files and only provides a way to serve those files.

To make it easier, I have provided all of the files needed in this repo in the TFTP folder. Copy everything in TFTP folder of this repo to the VirtualBox storage directory. Depending on your system it will be in a different location.

On OSX it is ~/Library/Virtualbox/TFTP
On Linux it is ~/.config/VirtualBox/TFTP/

Note: You may have to create this directory if it doesn't exist.

One liner to download and extract the TFTP folder

curl https://codeload.github.com/defunctzombie/virtualbox-pxe-boot/tar.gz/master | tar zx --strip-components 1

Symlink pxelinux.0 to vmname.pxe

From the Virtualbox Docs

6.3.2. PXE booting with NAT PXE booting is now supported in NAT mode. The NAT DHCP server provides a boot file name of the form vmname.pxe if the directory TFTP exists in the directory where the user's VirtualBox.xml file is kept. It is the responsibility of the user to provide vmname.pxe.

What this means is that in order for VirtualBox to actually PXE boot your machine, it will look for a file called vmname.pxe (where vmname is the name of your virtual machine). Avoid spaces or other special characters in vm names.

On my system, I created a vm called test so I would then make a symlink called test.pxe to pxelinux.0

ln -s ./pxelinux.0 test.pxe

Boot the VM

Click boot and if all went well, you will see a menu with two entries:

  • Install
  • Kickstart Install

Select either one to try it out!

Further config

At this point the PXE booting works and you see a menu with two example items I have provided. That is the main extent of this guide however here are some more details about the menu items and configuration.

The menu entries are configured in TFTP/pxelinux.cfg/default. This is just a text file. Open it and you will find that the menu entry items look similar to grub boot item lines.

The Install menu entry simply boots the Ubuntu wily amd64 installer. The kernel and initrd files were both downloaded from the ubuntu ftp archive and placed in the installers/ubuntu/wily/amd64/ directory. In this way you could support many different OS versions and vendors.

The Kickstart Install is identical to the Install entry except that it provides a kickstart config file to automate the install process. Kickstart stuff is outside of the scope of this guide, but suffice to say you can automate basically any part of the install.

NOTE: The kickstart file is retrieved via HTTP. For the examples here I simply put the kickstart file from kickstart/basic.cfg on pastebin so that no extra HTTP server is needed. For testing this is usually sufficient but for production setups you will need to serve your kickstart files via some http server.

References

You can’t perform that action at this time.