[vbox-dev] How to add a new network device

Robert Zeljko robertzeljko at yahoo.com
Thu May 3 17:40:50 GMT 2007

I wanted to summarize for others who might want to try this, what needs to be
done in order to add a new network device to the VirtualBox.

1. Create src/VBox/Devices/Network/DevNewNet.cpp (pick your own file name here)
2. Update src/VBox/Devices/Makefile and include DevNewNet.cpp
3. Update src/VBox/Devices/Builtins.cpp and register you new device
4. Your PDMDEVREG structure from the DevNewNet.cpp has szDeviceName field. I'm
going to assume it is set to "newNetworkAdapter". You need to register this new
name/device with the vbox VM, not the VirtualBox per-se but the instance of an
virtual machine. If you don't have one, you might want to create it first.
>From the shell/command prompt run:
VBoxManage setextradata "your VM name here"
"VBoxInternal/Devices/newNetworkAdapter/0/Trusted" 1
VBoxManage setextradata "your VM name here"
"VBoxInternal/Devices/newNetworkAdapter/0/PCIDeviceNo" 5
VBoxManage setextradata "your VM name here"
"VBoxInternal/Devices/newNetworkAdapter/0/PCIFunctionNo" 0

Maybe you don't need to add all of this extra data but this has worked for me.
Note you might want to pick a PCIDeviceNo which is not conflicting with an
existing PCIDeviceNo. To check this, you can look at
~/.VirtualBox/Machines/some-vm-name/VBox.log as Knut has suggested.

Hope this helps!

-- robert

--- "Knut St. Osmundsen" <bird at innotek.de> wrote:

> Robert Zeljko wrote:
> > Hello,
> > 
> > I'm having some difficulties adding a new network device to the VirtualBox.
> > My attempt is based on existing device implemented in the
> > .../Network/DevPCNet.cpp.
> > I've updated the Devices/Makefile and added my device in there.
> > I've also updated Devices/Builtins.cpp to register my new device.
> > I can compile it and run it but my new network device never gets
> constructed.
> > What am I missing?
> You need to configure the device for the VM which you wish to use it in. 
> There are two ways of doing this:
> - you modify Console::configConstructor() in 
> src/VBox/Main/ConsoleImpl.cpp so that is uses your NIC instead of pcnet.
> - or, you use VBoxManage setextradata some-vm-name "VBoxInternal/..." 
> "value" to inject the necessary configuration data (take a look at the 
> CFGM dump in a ~/.VirtualBox/Machines/some-vm-name/VBox.log for seeing 
> what's needed and later checking what's actually inserted).
> Kind Regards,
>   knut
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> http://vbox.innotek.de/mailman/listinfo/vbox-dev

More information about the vbox-dev mailing list