title: How do I setup dnsmasq to serve address from multiple ranges with the same gateway to combat address exhaustion?
body: <p>I have a dnsmasq server which I am using to serve DHCP and cache DNS.  It is running on a Raspberry Pi. The range of addresses available in the pool is too small for the number of devices that regularly enter and leave the network, so I am trying to get it to serve addresses from a different subnet, but using the same gateway. but it is only allocating from one range.</p>
  
  <p>There is lots of advice on how to allocate to different subnets based on which NIC is servicing the request or on mac address, but nothing on combining subnets in this way from a single NIC and having them use a single gateway.  What is there suggests that the setup below should just work, but it just doesn't.</p>
  
  <p>The man page is no help either.</p>
  
  <p>Situation:</p>
  
  <pre><code>router/gateway: 192.168.1.1
  DNS/DHCP: 192.168.1.2
  reserved: 192.168.1.3-150
  </code></pre>
  
  <p>ON DNS Server:
  /etc/network/interfaces</p>
  
  <pre><code>auto eth0
  auto lo
  iface lo inet loopback
  iface eth0 inet static
  address 192.168.1.2
  gateway 192.168.1.1
  netmask 255.255.0.0
  network 192.168.0.0
  broadcast 192.168.1.255
  </code></pre>
  
  <p>On DNS Server /etc/dnsmasq.conf</p>
  
  <pre><code>#/etc/dnsmasq.conf
  domain-needed
  bogus-priv
  domain=local.net
  expand-hosts
  local=/local.net/
  listen-address=192.168.1.2
  bind-interfaces
  cache-size=1000
  dhcp-authoritative
  dhcp-leasefile=/var/lib/dhcp/dhcpd.leases
  dhcp-range=eth0,192.168.1.150,192.168.1.250,255.255.0.0,24h
  dhcp-range=eth0,192.168.2.10,192.168.2.250,255.255.0.0,24h
  dhcp-range=eth0,192.168.3.10,192.168.3.250,255.255.0.0,24h
  dhcp-range=eth0,192.168.4.10,192.168.4.250,255.255.0.0,24h
  dhcp-option=3,192.168.1.1
  dhcp-option=6,192.168.1.2
  dhcp-option=42,192.168.1.2
  server=8.8.8.8
  server=8.8.4.4
  server=208.67.220.220
  </code></pre>