From 8eeceb3646b0419da61fc582f285f2c04b20b379 Mon Sep 17 00:00:00 2001 From: Ruben Kerkhof Date: Mon, 17 Jan 2022 15:38:19 +0100 Subject: [PATCH] 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 --- lib/vagrant-libvirt/action/create_network_interfaces.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/vagrant-libvirt/action/create_network_interfaces.rb b/lib/vagrant-libvirt/action/create_network_interfaces.rb index 416358c..b7e7eaf 100644 --- a/lib/vagrant-libvirt/action/create_network_interfaces.rb +++ b/lib/vagrant-libvirt/action/create_network_interfaces.rb @@ -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