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
On Tuesday, May 10, 2016 at 2:35:46 PM UTC-7, Alvaro Miranda Aguilera wrote:
>
> did you try them?
>
> On Wed, May 11, 2016 at 9:28 AM, Robert F <[email protected]
> <javascript:>> wrote:
>
>> I have reasons for not wanting to use DHCP in this situation. And the
>> Vagrant doc which you mentioned, and which I had already read, does not
>> provide a way to differentiate between specifying an IPv4 address versus an
>> IPv6 address. The config.vm.network directives are identical which suggests
>> there may be no way to do this.
>>
>> On Tuesday, May 10, 2016 at 2:20:25 PM UTC-7, Alvaro Miranda Aguilera
>> wrote:
>>>
>>> Hello,
>>>
>>> The easiest way is use bridge and let the dhcp/dhcpv6 to take care:
>>> https://www.vagrantup.com/docs/networking/public_network.html
>>>
>>> Or you can create 2 networks, one for ipv4 other for ipv6 and set the ip
>>> like this:
>>> https://www.vagrantup.com/docs/networking/private_network.html
>>>
>>> Alvaro.
>>>
>>> On Wed, May 11, 2016 at 8:05 AM, Robert F <[email protected]> wrote:
>>>
>>>> I should have mentioned that I'm running Vagrant on a Mac, not
>>>> Windows. Yes, if you have any examples of how this is done, I would love
>>>> to see them.
>>>>
>>>> On Tuesday, May 10, 2016 at 12:39:43 PM UTC-7, Robert F wrote:
>>>>>
>>>>> Is it possible to create a private network on a Vagrant box that has
>>>>> both an IPv4 and IPv6 address? I'd like to do something like this:
>>>>>
>>>>> config.vm.network "private network", ip: "192.168.1.100"
>>>>> config.vm.network "private network", ip6: "<some internal private IPv6
>>>>> address>"
>>>>>
>>>>> The reason I'd like to do this is that I have an Ansible play that
>>>>> needs to reference "ansible_default_ipv6.address" but there is no such
>>>>> address associated with my Vagrant VM if I'm also using an IPv4 address.
>>>>> The Vagrant documentation doesn't discuss this so I'm guessing its not
>>>>> possible but I thought I would check here in case there's some
>>>>> undocumented
>>>>> way to do it.
>>>>>
>>>>> Thanks!
>>>>>
>>>> --
>>>> This mailing list is governed under the HashiCorp Community Guidelines
>>>> - https://www.hashicorp.com/community-guidelines.html. Behavior in
>>>> violation of those guidelines may result in your removal from this mailing
>>>> list.
>>>>
>>>> GitHub Issues: https://github.com/mitchellh/vagrant/issues
>>>> IRC: #vagrant on Freenode
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Vagrant" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/vagrant-up/484eca69-6808-4c70-a2bb-17c3e0299699%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/vagrant-up/484eca69-6808-4c70-a2bb-17c3e0299699%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>> This mailing list is governed under the HashiCorp Community Guidelines -
>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>> violation of those guidelines may result in your removal from this mailing
>> list.
>>
>> GitHub Issues: https://github.com/mitchellh/vagrant/issues
>> IRC: #vagrant on Freenode
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Vagrant" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/vagrant-up/0dd868c5-45ac-47e0-b175-295695156ff2%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/vagrant-up/0dd868c5-45ac-47e0-b175-295695156ff2%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/ddc80647-922f-46a7-9876-4a95132deb76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.