[Dnsmasq-discuss] dnsmasq host being dhcp server to itself [WAS: Web hang ups after repeated access to one site - dnsmasq related?]

Hugo Heden hugoheden at gmail.com
Thu Feb 19 11:59:43 GMT 2009


Hi again,

On Thu, Feb 19, 2009 at 2:53 AM, richardvoigt at gmail.com
<richardvoigt at gmail.com> wrote:
> Please keep replies on the list.
>
> On Wed, Feb 18, 2009 at 10:15 AM, Chris Green <chris at isbd.co.uk> wrote:
>> On Wed, Feb 18, 2009 at 01:50:08AM +0000, richardvoigt at gmail.com wrote:
>> [snip]
>>> >
>>> > No other configuration files needed -- on any host -- just let
>>> > everybody use dhcp. Super easy. But will this work?
>>>
>>> No.  dnsmasq determines which dhcp-range to use when giving out
>>> addresses from the IP address configured on the interface where the
>>> DHCP-REQUEST packet is received (or the interface address passed along
>>> by a dhcp-relay agent).  As you can see this cannot possibly work to
>>> assign addresses to the dnsmasq box.  There's no way around this
>>> because in general dnsmasq runs on your gateway which by definition
>>> has multiple interfaces.
>>>
>> While I'm not sure about having a 'server' assign an IP to itself it's
>> surely not true that "in general dnsmasq runs on your gateway which by
>> definition has multiple interfaces" - in fact it's very often *not*
>> true.
>
> I didn't say running on the gateway was an absolute necessity, I said
> it's the general (i.e. usual, common) case.  Actually it is probably
> only the common case for configurations using dnsmasq for DHCP.
>
> I'd venture to guess that multiple dhcp-ranges (including dhcp-relay)
> is actually more common that your scenario.
>
>>
>> My situation is fairly typical I would have thought:-
>>
>>    192.168.1.1 - Draytek Vigor 2820n router, statically assigned IP
>>    192.168.1.4 - Linux 'server' running dnsmasq, currently static
>>    192.168.1.xxx - other systems/devices, DHCP from 192.16.1.4
>>
>> The system running dnsmasq (192.168.1.4) has only one interface, on
>> the local subnet, default route is set to 192.168.1.1 and it's *that*
>> which has the multiple interfaces (two more going to the outside world
>> in my case).
>>
>> Surely this is pretty common, a proprietary router which doesn't do
>> DHCP as one wants it to, so put dnsmasq on an always on Linux box on
>> the local LAN.
>
> I think more people use the "always on Linux box" as the router in
> that scenario, since if you want better DHCP than comes in the router
> you probably also want netfilter instead of what firewall comes in the
> router.
>
>>
>>
>> In my case it's certainly true that there are "No other configuration
>> files needed", I just have /etc/hosts on 192.168.1.4 with the static
>> addresses in it, /etc/resolv.conf with:-
>>
>>    nameserver 127.0.0.1
>>    nameserver 195.74.113.58
>>    nameserver 195.74.113.62
>>
>> ... and a pretty straightforward dsnmasq.conf file.
>
> Yes and now you have the additional problems of how to get dnsmasq to
> know its own host needs an address (broadcast packets usually aren't
> delivered to processes on the sender).  Assigning the address directly
> via the kernel interfaces isn't feasible because (a) dnsmasq runs on
> many different OSes (b) dnsmasq drops root privilege that would be
> necessary to make an address assignment and (b2) interfaces can come
> up and down as media events are processed, tunnels are created, etc.
>

Is what you are talking about here a setup where the host running
dnsmasq would be a dhcp-client to itself?

In that case, I think I may be at fault for any confusion here. To my
knowledge, Chris G never said he does that -- it was just how I
twisted this thread.

> In addition, allowing the IP address of the DHCP server to change is
> extremely bad because it breaks the renewal process.
>
> At some point Simon, the author, is going to wade into this discussion
> with about a dozen more reasons I haven't thought of.
>

Ok, I think it clear to us all now that it's a bad bad idea to do
that, thanks a lot, Richard!

Best regards

Hugo Heden



More information about the Dnsmasq-discuss mailing list