VirtualBox LAN boot ROM

You can use gPXE as the LAN boot ROM in VirtualBox. The boot ROM can be set per-VM or globally for all VMs. Using gPXE instead of the default LAN boot ROM, VMs can be booted over HTTP, iSCSI, AoE, and gPXE's other advanced features are available.

Build the ROM image

Check which network adapter is configured for the VM.

Here are the adapters supported by VirtualBox v3.1.2 [from a VirtualBox (non-GPL ed.) on Fedora 12 (i686) installation]:

VirtualBox Adapter 'type' PCI Vendor ID PCI Device ID Mfr Name Device Name Notes
Am79C970A 1022h 2000h AMD PCnet-PCI II (AM79C970A)
Am79C973 1022h 2000h AMD PCnet-PCI III (AM79C973) Default for Most Guest VM OS Choices
82540EM 8086h 100Eh Intel Intel PRO/1000 MT Desktop (82540EM) Default for Windows Vista/Windows 7 VMs
82543GC 8086h 1004h Intel Intel PRO/1000 T Server (82543GC)
82545EM 8086h 100Fh Intel Intel PRO/1000 MT Server (82545EM)
virtio 1AF4h 1000h Qumranet? Paravirtualized Network (virtio-net)


Build the appropriate ROM image:

cd gpxe/src
make bin/10222000.rom  # for pcnet32 1022:2000

Fix up the ROM image

VirtualBox has the following requirements on ROM image size:

  1. Size must be 4K aligned (i.e. a multiple of 4096)
  2. Size must not be greater than 64K

Check that your image is not larger than 65536 bytes:

$ ls -l bin/10222000.rom | awk '{print $5}'
55296

Pad the image file to a 4K boundary:

$ python
>>> (55296 + 4095) & ~4095    # Round up to 4K aligned size
57344
>>> 57344 - 55296             # Calculate padding size
2048
>>> f = open('bin/10222000.rom', 'a')
>>> f.write('\0' * 2048)      # Pad with zeroes

Configure the VM to use the LAN boot ROM

Use vboxmanage to set the LanBootRom path:

vboxmanage setextradata $VM_NAME VBoxInternal/Devices/pcbios/0/Config/LanBootRom /path/to/10222000.rom

Replace $VM_NAME with your VM's name. If you use “global” as $VM_NAME then all VMs will use the gPXE LAN boot ROM.

Now start the VM and press F12 to choose network booting:

virtualbox -startvm $VM_NAME

To automatically boot gPXE, change the VM boot priorities to try booting from the network first.

Unconfiguring the VM

If you wish to stop using gPXE:

vboxmanage setextradata $VM_NAME VBoxInternal/Devices/pcbios/0/Config/LanBootRom