[Dnsmasq-discuss] DHCP service to multiple subnets?

Simon Kelley simon@thekelleys.org.uk
Fri, 17 Dec 2004 18:08:20 +0000

Scott Bussinger wrote:
> I searched the net looking to see if this question had been answered
> somewhere, but didn't see anything. I'm putting together a Linux router box
> to serve as the main gateway/firewall for my office and would like to use
> DNSMasq on it for DNS and DHCP.
> This box has several ethernet ports on it and each will be statically
> assigned to a different subnet (one for the internet connection, one for
> local machines, one for DMZ machines, and one for guest machines with
> internet access but no local access)
> If possible I'd like to use DNSMasq to provide DHCP services to each of the
> subnets. Basically any machine attaching through eth3 would get one subnet,
> machines attaching through eth2 would get a different subnet, etc. Is this
> possible? It seems like there's sufficient capabilities to do this, but it's
> not obvious to me how it would be done.
> Thanks for your help!

Just provide a dhcp-range option for each subnet: dnsmasq will handle 
the rest. For example, if you have

eth0 with IP address
eth1 with IP address
eth2 with IP address

then put something like the following in /etc/dnsmasq.conf


Make sure that the netmasks are correct  on your interfaces and dnsmasq 
will use the correct range for each interface.