VirtualBox on FreeBSD cheat sheet: Difference between revisions

From ZS64
Jump to navigationJump to search
No edit summary
Line 14: Line 14:
The first enables non-root processes to open the tap interface, the seconds ifconfig up's the interface when the tap device is opened.
The first enables non-root processes to open the tap interface, the seconds ifconfig up's the interface when the tap device is opened.


Finally, add a rule to devfs.rules(5) to make the device node accessible to users running VirtualBox.
[diesel=100]
add path tap* group wheel mode 660
(In rc.conf, I have devfs_system_ruleset="diesel", and my user is a member of the wheel group.)


==Patch for proper handling of VNC on IPv6-enabled machines==
==Patch for proper handling of VNC on IPv6-enabled machines==

Revision as of 16:27, 16 April 2013

Network configuration with host bridge and bridged guest networking

It appears that there is a problem with bridged guest networking when the interface you want to bridge to on the host is an if_bridge(4) interface. It doesn't seem to work with either the bridge interface, a physical interface or a vlan(4) interface.

What does work is to use a tap(4) interface for the VM. Unfortunately, VirtualBox requires exclusive use of the tap interface per VM, so you need to set up one for each VM.

Add all the required tap(4) interfaces to rc.conf(5):

cloned_interfaces="bridge0 tap0 tap1"
ifconfig_bridge0="ether 02:00:00:00:00:01 addm tap0 addm tap1 addm em0"

Add these two lines to sysctl.conf(5):

net.link.tap.user_open=1
net.link.tap.up_on_open=1

The first enables non-root processes to open the tap interface, the seconds ifconfig up's the interface when the tap device is opened.

Finally, add a rule to devfs.rules(5) to make the device node accessible to users running VirtualBox.

[diesel=100]
add path tap* group wheel mode 660

(In rc.conf, I have devfs_system_ruleset="diesel", and my user is a member of the wheel group.)

Patch for proper handling of VNC on IPv6-enabled machines

PR #174976 has a patch to enable proper configuration of libvncserver when it's compiled with IPv6 support; the stock VirtualBox does not properly deal with this case, and leaves the IPv6 port number set to it's default value of 5900. This in turn means that you can only enable VNC on one of the VMs, as each subsequent one will fail to start up.

The following variables influence the selection of addresses and port numbers:

$ VBoxManage modifyvm Ubuntu --vrdeport 5902
$ VBoxManage modifyvm Ubuntu --vrdeproperty VNCPort4=5902
$ VBoxManage modifyvm Ubuntu --vrdeproperty VNCPort6=5902
$ VBoxManage modifyvm Ubuntu --vrdeproperty VNCAddress4=0.0.0.0
$ VBoxManage modifyvm Ubuntu --vrdeproperty VNCAddress6=::

Both VNCPort4 or VNCPort6 default to the port number set by --vrdeport; if that is unset or at it's default value of 3389, the extension will try to automatically determine an available port number when the VM start.

VNCAddress4 and VNCAddrees6 default to INADDR_ANY and IN6ADDR_ANY_INIT, respectively, so libvncserver will listen on all host addresses.

See VBoxVNC.cpp source code for details.