Two ips get created, but can't disable DHCP without error. #103
Comments
|
You must have at least one network interface with DHCP enabled. Vagrant-libvirt depends on dnsmasq's DHCP leases file in order to find the IP address of the VM. It has to find this dynamic IP address before it can ssh in and set any static ip address you configured in your :ip definition in your Vagrantfile. Speaking of #102 and #104 as well as this issue, I plan to dig into reproducing your errors and improving how vagrant-libvirt handles them as time allows. |
|
Awesome, I look forward to it. Cheers, On Mon, Dec 16, 2013 at 4:02 PM, Brian Pitts notifications@github.comwrote:
|
|
I just hit a huge issue because of this... SO it's essential that vagrant-libvirt use the static address to connect, if one is configured, and should not use or need DHCP in this instance. If no static address is provided, then it makes sense to use DHCP. |
|
This problem occurs because you have two IP addresses on the same network, so linux can choose either one when routing traffic to that network. The solution is to have two different networks. One network (lets say the network named "default") should have DHCP enabled so that vagrant-libvirt can manage the VMs. The other network (for fun, lets name it "domokun") can have DHCP disabled and static ip addresses configured. Then, configure your puppet clients to talk to the puppetmaster using it's address on the domokun network. This is what I do to manage a hadoop cluster via vagrant-libvirt. I have a default network at 192.168.122.1/24 that vagrant-libvirt uses for management, and I have a hadoop network at 192.168.1.1/24 that the nodes use to talk to each other. |
|
I don't know that I agree that the guests should have to have more than one network. IMO, if you specify a static ip address, then vagrant should use that, and not make a separate DHCP network. Cheers |
|
We need a network with DHCP because libvirt doesn't provide a usable out-of-band mechanism [0] for assigning a specific IP address to a VM. Vagrant has to be able to ssh to a VM before it can configure a static IP address. It configures it by running networking utilities and editing configuration scripts just as you would do if you had sshed in yourself and were configuring it manually. This is the same process vagrant uses to set the hostname, mount shared folders, etc. This isn't something specific to vagrant-libvirt, it's functionality any provider inherits from vagrant. All the provider needs is a way to tell vagrant what IP address the VM has. We can do this with libvirt and DHCP because athough we don't know what address libvirt will assign to the VM ahead of time, we can find it in dnsmasq's leases file. [0] I say usable because at first glance you might think that the host element would work. However, this only works if you know all the hosts that will ever have a static IP address on the network at the time you create the network. Adding a new host later requires destroying, redefining, and restarting the network, which disconnect any running VMs from it. |
|
Hmmm... I thought you could pass ip= to the kernel command line to get it to configure the ip statically for first boot ? Would that work? |
|
I think that would only work for linux, but vagrant also support the BSDs, various flavors of solaris, etc. Even if that wasn't a problem, AFAIK there's no mechanism for passing kernel boot options into the VM while using the BIOS bootloader. |
ezecampoli
commented
Jan 17, 2014
|
Can I add a new issue? I'm working with libvirt as a provider for my vagrant project and when tap the command vagrant up --provider libvirt, I'm continuously getting this message.. "grep: /var/lib/libvirt/dnsmasq/*.leases: No such file or directory solved". The thing is I would like to connect the VMs with DHCP by eth0 interface (subnet 192.168.1.xxx) and keep using wlan0 interface (another subnet 192.168.10.xxx) in this case I'm getting a static IP. The problem is because libvirt doesn't know how to manage the DNS? I really doesn't know how to proceed. Any ideas about my problem? Thanks in advance. |
|
Hi ezecampoli, please open a new issue including your Vagrantfile and the output of |
|
I think this issue happens because he hasn't specified DHCP for the first On Fri, Jan 17, 2014 at 2:06 PM, Brian Pitts notifications@github.comwrote:
|
sciurus
added a commit
to sciurus/vagrant-libvirt
that referenced
this issue
Jan 18, 2014
|
|
sciurus |
4630650
|
|
Can we close this now? |
|
@pronix close this please. |
purpleidea commentedDec 12, 2013
Hi, I've written a write up of vagrant-libvirt on Fedora 19 [1].
Here is one bug (and workaround) that I found. Fixes upstream would be awesome!
I was asked to report it:
With this Vagrantfile, you’ll get an IP address from DHCP, and a static IP address from the :ip definition. If you attempt to disable DHCP with :libvirt__dhcp_enabled => false you’ll see errors:
grep: /var/lib/libvirt/dnsmasq/*.leases: No such file or directory
[1] https://ttboj.wordpress.com/2013/12/09/vagrant-on-fedora-with-libvirt/
Cheers,
James