2

With below code, I can set the custom management network for guests, it works and sets vagrant management network ip addresses for the machines in defined network from DHCP pool. But I need to set specific ip adress for a specific machine, not from DHCP pool. Is there a way to set a static ip?

config.vm.provider "libvirt" do |v|
    v.management_network_name = "my_network"
    v.management_network_address = "10.11.12.0/24"
end
edib
  • 812
  • 1
  • 11
  • 20

1 Answers1

3

I have found a non-proper way by a host command which runs virsh. But it worked.

system("virsh net-update my-network add ip-dhcp-host \"<host mac='52:54:00:fb:95:91' ip='10.11.12.13' />\" --live --config")

config.vm.provider "libvirt" do |v|
    v.management_network_name = "my_network"
    v.management_network_address = "10.11.12.0/24"
    v.management_network_mac = "52:54:00:fb:95:91"
end

edib
  • 812
  • 1
  • 11
  • 20