Problem:

You are using VirtualBox in headless mode and you have to setup

hostonly networking with a specific VirtualMachine,

adding a new hostonly interface with an enabled dhcp server.

Step 1 - (Create a new interface):

First you have to add a new hostonly/dhcp interface using the command:

/opt/VirtualBox/VBoxNetAdpCtl add

Note that at the moment the interface name is harcoded/determined by the

"VBoxNetAdpCtl" command, so you can't call it for istance

"foobarif0", a fixed name "vboxnetN" will be assigned (eg: vboxnet1)

Step 2 - (Add and enable a dhcp server)

Now you can add, if you wish to, a dhcp server to the new interface

"vboxnet1" and configure a dhcp range, for example, with the command:

VBoxManage dhcpserver modify --ifname vboxnet1 --ip 192.168.1.254 \ --netmask 255.255.255.0 --lowerip 192.168.1.0 --upperip 192.168.1.250 --enable

Step 3 - (Register the interface and enable HostOnly newtworking)

Now you can register the "new" hostonly, dhcp enabled,

interface "vboxnet1" with an existing VirtualMachine with the

following commands:

VBoxManage modifyvm wxp --nic1 hostonly

VBoxManage modifyvm wxp --hostonlyadapter1 vboxnet1

Step 4 - (Start the VM with VBoxRDP)

Finally you can start the VirtualMachine (and connect later to it

via RDP with an rdp client, rdesktop for example), let's fire up the

VirtualMachine with the command:

VBoxVRDP -s MachineName

Enjoy! :)

Notes:

Not sure if it is a bug or a default behaviour but keep in mind

that a new/different hostonly adapter must be first created

manually with "VBoxNetAdpCtl" and then registered later with the

virtualmachine, on the official manual this is not reported[1].

[1] http://www.virtualbox.org/manual/UserManual.html#vboxmanage-dhcpserver

Comments

Related content