VirtualBox on FreeBSD cheat sheet
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.