9 Advanced topics

For each of the above variants, you can register the resulting image for immediate use in VirtualBox by adding -register to the respective command line. The image will then immediately appear in the list of registered disk images. An example is

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5 -relative -register

which creates an image referring to individual partitions, and registers it when the image is successfully created.

9.12Allowing a virtual machine to start even with unavailable CD/DVD/floppy devices

When, on VM startup, a CD, DVD or floppy device is unavailable, VirtualBox by default prints an error message and refuses to start the virtual machine. In some situations this behavior is not desirable.

The behavior can be changed for the CD/DVD drive with the following configuration change command:

VBoxManage setextradata "YourVM" "VBoxInternal/Devices/piix3ide/0/LUN#2/Config/AttachFailError" 0

The equivalent command for the floppy drive is:

VBoxManage setextradata "YourVM" "VBoxInternal/Devices/i82078/0/LUN#0/Config/AttachFailError" 0

You will still get a warning message that a device is not available. Some guest oper- ating systems may show strange behavior when using saved state or snapshots, espe- cially if a previously mounted medium is no longer available when the virtual machine is resumed.

9.13 Fine-tuning the VirtualBox NAT engine

9.13.1 Configuring the address of a NAT network interface

In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24 by default where x corresponds to the instance of the NAT interface +2 of that VM. So x is 2 if there is only one NAT instance active. In that case the guest is assigned to the address 10.0.2.15, the gateway is set to 10.0.2.2 and the name server can be found at 10.0.2.3.

If, for any reason, the NAT network needs to be changed, this can be achieved with the following command:

VBoxManage modifyvm "My VM" --natnet1 "192.168/16"

148

Page 148
Image 148
Sun Microsystems VERSION 3.1.0_BETA2 user manual Fine-tuning the VirtualBox NAT engine