2

I am using vagrant with Ubuntu 14.04 and libvirt/KVM.

When I create VM, Vagrant add default NIC(management network) in range 192.168.121.0/24. I don't want to use this network range. Yes, we can modify/delete after VM up but, I want to know if any option in Vagrantfile that can change or delete default network. I know how to add public or private network and configuration.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
user5402
  • 33
  • 5

2 Answers2

3

To change default network you need to define new network in libvirt where you specify

 <domain name='my_network'/>
 <ip address='192.168.77.1' netmask='255.255.255.0'>

after that you add lines

libvirt.management_network_name = 'my_network'
libvirt.management_network_address = '192.168.77.0/24'

into provider section. Example of whole provider section:

config.vm.provider "libvirt" do |libvirt|
      #use the storage pool named external
      #libvirt.storage_pool_name = "external"
      libvirt.driver = "kvm"
      libvirt.memory = 1024
      libvirt.cpus = 1
      libvirt.management_network_name = 'my_network'
      libvirt.management_network_address = '192.168.77.0/24'
  end
user2910552
  • 215
  • 3
  • 4
2

Vagrant-lbvirt creates a virtual network in libvirt for managing VMs. Its default name is vagrant-libvirt and by default uses IP in range 192.168.121.0/24.

The name and address used by this network are configurable at the provider level.

management_network_name - Name of libvirt network to which all VMs will be connected. If not specified the default is 'vagrant-libvirt'.

management_network_address - Address of network to which all VMs will be connected. Must include the address and subnet mask. If not specified the default is '192.168.121.0/24'.

management_network_guest_ipv6 - Enable or disable guest-to-guest IPv6 communication.

Read more here https://github.com/pradels/vagrant-libvirt#management-network .