Fix static ipv6 ips on private networks (#1436)

When the :ip is ipv6, set the 'static6' type, so that we select the
correct _static6.erb template to configure the interface in the guest.

With the following configuration, ipv6 works out of the box on CentOS 8:

  (1..2).each do |i|
    config.vm.define "node#{i}" do |node|
      node.vm.hostname = "node#{i}"

      node.vm.network :private_network,
        :ip => "fc00::#{i+9}",
        :netmask => "64",
        :libvirt__dhcp_enabled => false,
        :libvirt__forward_mode => "veryisolated",
        :libvirt__network_name => "test"
    end
  end

Fixes: #914
This commit is contained in:
Ruben Kerkhof 2022-01-17 15:38:19 +01:00 committed by GitHub
parent a9e0fefa1d
commit 8eeceb3646
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,6 +216,9 @@ module VagrantPlugins
gateway: options[:gateway],
route: options[:route]
}.merge(network)
if IPAddr.new(options[:ip]).ipv6?
network[:type] = :static6
end
else
network[:type] = :dhcp
end