Bhyve + IPv6
October 20, 2017
bhyve + ipv6
This is how to set assign IPv6 addresses to guest within
bhyve on a server with one single network card, the trick
to make this to work is to assign the/handle the IPs within the bridge in
auto_linklocal
mode.
The rc.conf
file:
ifconfig_igb0="inet X.X.X.X netmask 255.255.255.XXX"
defaultrouter="X.X.X.X"
gateway_enable="YES"
ipv6_activate_all_interfaces="YES"
ipv6_defaultrouter="fe80::1%bridge0"
ipv6_gateway_enable="YES"
cloned_interfaces="bridge0 tap0"
autobridge_interfaces="bridge0"
autobridge_bridge0="tap* igb0"
ifconfig_bridge0="addm igb0 addm tap0 up description bhyve"
ifconfig_bridge0_ipv6="inet6 2a01:4f8:350:84ec::1 prefixlen 64 auto_linklocal"
rtadvd_enable="YES"
rtadvd_interfaces="bridge0"
The rtadvd.conf
file:
bridge0:\
:addr="2a01:4f8:350:84ec::":prefixlen#64:\
:rdnss="2a01:4f8:350:84ec::1":\
:dnssl="nbari.com":
By doing this, the bhyve guest VM's can ping the main host, and use local services like unbound for DNS resolution.
In the logs you will notice something like this:
bridge0: IPv6 addresses on igb0 have been removed before adding it as a member to prevent IPv6 address scope violation.
This can be avoided by using:
sysctl net.link.bridge.allow_llz_overlap=1
But will cause in terms that the guests may get an IP but not the router gateway.