add some ipv6 support between vms

This commit is contained in:
dima 2016-12-07 00:40:44 +01:00
parent c1898be3d6
commit 8dfe8d5260
3 changed files with 23 additions and 0 deletions

View File

@ -458,6 +458,12 @@ An examples of network interface definitions:
# default is 127.0.0.1 if omitted
# :libvirt__tunnel_ip => '127.0.0.1',
:libvirt__tunnel_port => '11111'
# network with ipv6 support
test_vm1.vm.network :private_network,
:ip => "10.20.5.42",
:libvirt__guest_ipv6 => "yes",
:libvirt__ipv6_address => "2001:db8:ca2:6::1",
:libvirt__ipv6_prefix => "64"
# Guest 2
config.vm.define :test_vm2 do |test_vm2|
@ -466,6 +472,12 @@ An examples of network interface definitions:
# default is 127.0.0.1 if omitted
# :libvirt__tunnel_ip => '127.0.0.1',
:libvirt__tunnel_port => '11111'
# network with ipv6 support
test_vm2.vm.network :private_network,
:ip => "10.20.5.45",
:libvirt__guest_ipv6 => "yes",
:libvirt__ipv6_address => "2001:db8:ca2:6::1",
:libvirt__ipv6_prefix => "64"
# Public Network
@ -557,6 +569,8 @@ starts with `libvirt__` string. Here is a list of those options:
See [here](https://libvirt.org/formatnetwork.html#examplesPrivate6), and
[here](http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=705e67d40b09a905cd6a4b8b418d5cb94eaa95a8)
for for more information. *Note: takes either 'yes' or 'no' for value*
* `:libvirt__ipv6_address` - Define ipv6 address, require also prefix.
* `:libvirt__ipv6_prefix` - Define ipv6 prefix. generate string `<ip family="ipv6" address="address" prefix="prefix" >`
* `:libvirt__iface_name` - Define a name for the private network interface.
With this feature one can [simulate physical link
failures](https://github.com/vagrant-libvirt/vagrant-libvirt/pull/498)

View File

@ -56,6 +56,8 @@ module VagrantPlugins
netmask: @options[:netmask],
network_address: nil,
bridge_name: nil,
ipv6_address: options[:ipv6_address] || nil,
ipv6_prefix: options[:ipv6_prefix] || nil,
created: false,
active: false,
autostart: false,
@ -282,6 +284,9 @@ module VagrantPlugins
@network_netmask = @interface_network[:netmask]
@guest_ipv6 = @interface_network[:guest_ipv6]
@network_ipv6_address = @interface_network[:ipv6_address]
@network_ipv6_prefix = @interface_network[:ipv6_prefix]
@network_forward_mode = @options[:forward_mode]
if @options[:forward_device]
@network_forward_device = @options[:forward_device]

View File

@ -27,4 +27,8 @@
</ip>
<% end %>
<% if !@network_ipv6_address.nil? && !@network_ipv6_prefix.nil? %>
<ip family='ipv6' address="<%= @network_ipv6_address %>" prefix="<%= @network_ipv6_prefix %>"></ip>
<% end %>
</network>