Reputation: 43
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.
Upvotes: 3
Views: 2541
Reputation: 629
The proposed answer explain how to change the network but for the second part of the question:
delete default network
You can use a snippet like this:
Vagrant.configure("2") do |config|
...
config.vm.provider "libvirt" do |cfg|
cfg.mgmt_attach = false
end
...
end
You will have then to declare a private network for all vm or by vm basis.
Upvotes: 0
Reputation: 285
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
Upvotes: 3
Reputation: 111
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 .
Upvotes: 3