Bug 663664 - Several libvirt networks causes dnsmasq to hit DHCP lease max prematurely
Summary: Several libvirt networks causes dnsmasq to hit DHCP lease max prematurely
Keywords:
Status: CLOSED DUPLICATE of bug 537335
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Veillard
QA Contact:
URL:
Whiteboard:
: 674356 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-12-16 14:44 UTC by Kenni Lund
Modified: 2011-03-12 15:11 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-03-12 04:57:38 UTC
Embargoed:


Attachments (Terms of Use)

Description Kenni Lund 2010-12-16 14:44:40 UTC
Description of problem:
If you create a second libvirt network next to the default network, clients on both networks will incorrectly count towards the DHCP lease maximums of the two networks.

Eg. if the default network has a DHCP range of 253, while the second network has a DHCP range of 2, then starting one guest on the default network (out of a max of 253) followed by two guests on the second network (out of a max of 2), will cause the last guest to fail to get a DHCP IP address, since the total number of DHCP leases are already at 2.

Extending the range of the second network to 3, "fixes" the issue - but it's not really an option, if you have a limited set of IP addresses in a datacenter.

Version-Release number of selected component (if applicable):
--
Name       : libvirt
Arch       : x86_64
Version    : 0.6.3
Release    : 33.el5_5.3
--
Name       : dnsmasq
Arch       : x86_64
Version    : 2.45
Release    : 1.1.el5_3
--
Name       : kvm
Arch       : x86_64
Version    : 83
Release    : 164.el5_5.25
--

How reproducible:
- Always

Steps to Reproduce:
- See description above

Actual results:
(all real public IP-addresses have been replaced with "x.y.z" in the following section)
-------------------------------------
/var/log/messages gives the following error when the third guest asks for an IP:
-------------------------------------
dnsmasq[4233]: DHCPREQUEST(routedhcp) x.y.z.252 54:52:00:59:f5:1f 
dnsmasq[4233]: DHCPNAK(routedhcp) x.y.z.252 54:52:00:59:f5:1f no leases left


-------------------------------------
dnsmasq shows only one lease in the second network:
-------------------------------------
# cat /var/lib/misc/dnsmasq.leases
1292508954 54:52:00:0a:74:ef x.y.z.253 server02 *
1292507625 54:52:00:45:83:7c 192.168.122.47 * *


-------------------------------------
The default network:
-------------------------------------
<network>
  <name>default</name>
  <uuid>23472a3f-4c03-4661-87d6-d8164a4e6d13</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' forwardDelay='0' />
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>


-------------------------------------
The second network
-------------------------------------
<network>
  <name>routedhcp</name>
  <uuid>c1425882-e735-cf6e-a135-ea83e392445a</uuid>
  <forward mode='route'/>
  <bridge name='routedhcp' stp='on' forwardDelay='0' />
  <ip address='x.y.z.251' netmask='255.255.255.192'>
    <dhcp>
      <range start='x.y.z.252' end='x.y.z.253' />
      <host mac='54:52:00:59:f5:1f' name='server01' ip='x.y.z.252' />
      <host mac='54:52:00:0a:74:ef' name='server02' ip='x.y.z.253' />
    </dhcp>
  </ip>
</network>


-------------------------------------
Grepping after the running dnsmasq processes:
-------------------------------------
/usr/sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file=  --listen-address 192.168.122.1 --except-interface lo --dhcp-range 192.168.122.2,192.168.122.254 --dhcp-lease-max=253

/usr/sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/routedhcp.pid --conf-file=  --listen-address x.y.z.251 --except-interface lo --dhcp-range x.y.z.252,x.y.z.253 --dhcp-lease-max=2 --dhcp-host

Comment 1 Kenni Lund 2011-02-11 16:43:11 UTC
Refs #674356, which also contains a proposed patch (I haven't tested the patch, but the described solution sounds right).

Comment 2 Laine Stump 2011-03-12 04:57:38 UTC
An updated patch to fix this has been committed upstream:

   commit 13c00dde3171b3a38d23cceb3f9151cb6cac3dad
   Author: Laine Stump <laine>
   Date:   Fri Mar 11 13:20:48 2011 -0500

   network driver: Use a separate dhcp leases file for each network

This will be in libvirt-0.9.0.

Comment 3 Laine Stump 2011-03-12 05:00:48 UTC
*** Bug 674356 has been marked as a duplicate of this bug. ***

Comment 4 Laine Stump 2011-03-12 15:11:10 UTC

*** This bug has been marked as a duplicate of bug 537335 ***


Note You need to log in before you can comment on or make changes to this bug.