Heres three examples.
the first one is all static. hostmanager only takes the first ip address, in this case the v4 one, which is why alice has to ping bob the second time by ip address. you could get around it by running a nameserver or your own script to populate /etc/hosts
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
v4prefix = "10.11.12."
v6prefix = "fddd::"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.hostmanager.enabled = true
config.hostmanager.include_offline = true
config.vm.box = "ubuntu/trusty64"
config.vm.define "bob" do |bob|
bob.vm.hostname = "bob"
bob.vm.network "private_network", ip: v4prefix + "10"
bob.vm.network "private_network", ip: v6prefix + "10"
end
config.vm.define "alice" do |alice|
alice.vm.hostname = "alice"
alice.vm.network "private_network", ip: v4prefix + "11"
alice.vm.network "private_network", ip: v6prefix + "11"
alice.vm.provision "shell", inline: "ping -c 1 bob"
alice.vm.provision "shell", inline: "ping6 -c 1 #{v6prefix + "10"}"
end
end
This one routes v6 out miredo, good if your not on a v6 network, but want your vagrant network to go there. its technically NAT. but with v6 you dont need nat. which means, technically, this vagrant file does not exist ;) the static ip on client is just a dummy value.
# -*- mode: ruby -*-
# vi: set ft=ruby :
v4net="192.168.45."
v6net="fd12::"
router_script = <<SCRIPT
sysctl -w net.ipv6.conf.all.forwarding=1
mkdir /etc/iptables
cat <<EOF > /etc/iptables/rules.v6
*nat
-A POSTROUTING -o teredo -s #{v6net}/64 -j MASQUERADE
COMMIT
EOF
cat <<EOF > /etc/radvd.conf
interface eth1
{
AdvSendAdvert on;
prefix #{v6net}/64
{
AdvOnLink on;
AdvAutonomous on;
};
};
EOF
apt-get -y install miredo radvd
ip6tables-restore < /etc/iptables/rules.v6
SCRIPT
client_script = <<SCRIPT
cat <<EOF > /etc/network/interfaces.d/eth1.cfg
auto eth1
iface eth1 inet manual
iface eth1 inet6 auto
EOF
ifup eth1
SCRIPT
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.hostmanager.enabled = true
config.hostmanager.include_offline = true
config.vm.box = "ubuntu/trusty64"
config.vm.define "router" do |router|
router.vm.hostname = "router"
router.vm.network "private_network", ip: v6net + "10"
router.vm.provision "shell", inline: router_script
end
config.vm.define "client" do |client|
client.vm.hostname = "client"
client.vm.network "private_network", ip: v6net + "11", auto_config: false
client.vm.provision "shell", inline: client_script
end
end
if you want more of a v6 network to play on,
https://gitlab.com/pixelfairy/oasix