I know this question is years old at this point, but it's worth revisiting with an up-to-date answer, since none of the other answers addressed the problem that caused this on my machine.
First, to clarify - I was getting this error when trying to connect two virtual machines via an internal network - both were being assigned IPv6 addresses. Your question mentions your host machine getting an IPv6 address - your host should not be part of the network if you're using VirtualBox's internal network option. (Terminology may have changed in the 5 years since question was asked.)
Setting Up DHCP on Host
If you set the network settings of your virtual machine to use an internal network using the VirtualBox GUI and the machine settings, it will use IPv6 addresses by default - and they also won't be able to ping each other if you use ping6. The solution is to do a bit of DHCP server setup on the host machine using the VBoxManage
utility.
VBoxManage dhcpserver add \
--netname intnet \
--ip 10.2.0.1 \
--netmask 255.255.0.0 \
--lowerip 10.2.0.1 --upperip 10.2.0.255 \
--enable
This will set the DHCP server to hand out IP addresses in the range 10.2.0.1
to 10.2.0.255
. If the DHCP server already exists, you should change add
to modify
:
VBoxManage dhcpserver modify \
--netname intnet \
--ip 10.3.0.1 \
--netmask 255.255.0.0 \
--lowerip 10.3.0.1 --upperip 10.3.0.255 \
--enable
Finally, you can remove the DHCP server when you're finished using the remove command:
VBoxManage dhcpserver remove --netname intnet
Also see this YouTube video on setting up an internal network using VirtualBox.
Why other solutions didn't work
- Solution by @IanWilson doesn't work b/c
ifup eth0
will tell you eth0
is already up; bringing it down and back up will just re-assign it an IPv6 address (and ping6
still won't be able to reach other virtual machines on the internal network).
- Solution by @grawity doesn't work b/c
dhclient eth0
will either lead to interface getting another IPv6 address, or the interface will lose its IPv6 address altogether.
- @Steven's answer and @epingle's answer both address a bridged network situation, where the host can communicate with the virtual boxes over the network, and not an internal network setup, where only the virtual boxes are connected to the network.