[Dnsmasq-discuss] DHCP for multiple subnets - hostname to IP mapping
Ron Frederick
ronf at timeheart.net
Wed Oct 6 16:16:14 BST 2010
On Oct 6, 2010, at 7:21 AM, Brandl, Tobias wrote:
>
> I'm struggling for a couple of days now with the DHCP setup in my sample
> network environment. Here's what I'm trying to do:
> * I'm setting up an environment where severs should get their IPs via
> DHCP name -> IP mapping (fixed or static IP)
> * Each server has two NICs, one used in a client LAN (192.168.1.0/24)
> and one in a backend LAN (storage access, etc. - 192.168.101.0/24)
> * Each server should get IPs for the different subnets based on the
> hostname provided, e.g.
> ** requesting an IP for server01(.clnt.localnet) via the client LAN
> should be mapped to 192.168.1.10
> ** requesting an IP for server01(.bknd.localnet) via the backend LAN
> should be mapped to 192.168.101.10
>
> I think I've tried almost every combination of dhcp-host, dhcp-range,
> dhcp-fqdn, and /etc/hosts entries without any success.
> I'm either getting "no address available" once the second interface
> comes up or it receives an IP different from the one set in /etc/hosts -
> even though dnsmasq logs show that the name is "known" (matching
> dhcp-host entry found).
>
> Could anyone please help to sort this out?
I fought with this for a long time myself, as I really wanted to be able to do it with the mappings appearing only in /etc/hosts. I was never able to get that to work, though, and I finally gave up and ended up getting it to work with a couple of explicit dhcp-host lists in dnsmasq.conf. My config looks something like:
# global settings
bogus-priv
dhcp-authoritative
dhcp-fqdn
dhcp-leasefile=/tmp/dhcp.leases
domain-needed
expand-hosts
localise-queries
# read static host mappings out of ethers file
read-ethers
# timeheart.net is the public subnet, and internal.timeheart.net is a private one (and the default)
domain=timeheart.net,74.93.13.192/29
domain=internal.timeheart.net
# host assignments for quad, since /etc/hosts doesn't work when multi-homed
dhcp-host=74.93.13.193,quad.timeheart.net
dhcp-host=192.168.1.2,quad.internal.timeheart.net
All other IP addresses are assigned via entries in /etc/hosts.
--
Ron Frederick
ronf at timeheart.net
More information about the Dnsmasq-discuss
mailing list