[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: DnsMasq: Happy Happy Joy Joy



On Sat, Sep 20, 2003 at 12:27:52AM -0400, Joey Hess wrote:
> tb.nospam@comcast.net wrote:
> > The docs aren't very prescriptive and the new versign-blocker isn't
> > documented at all, so here's what I did.
> > 
> > 1. If you're running Woody or Sid, you'll have dhcp-client.  DnsMasq recommends
> > resolvconf, and dhcp3-client or dhcpcd or ... It's a whole kettle of fish.
> > 2. So, to keep it simple, I patched /etc/dhclient-script:
> 
> I encourage anyone who has a laptop or other machine that moves between
> networks a lot to give the resolvconf + dnsmasq combo a try. You can't
> use dhcp-client with resolvconf yet, but dhcp3-client, dhcpcd, and pump
> will all work. It's not much bother to set resolvonf, and it's well
> worth the bother. In less than an hour's playing with it, I got this
> setup working:
> 
> - If I pon, it gets the forwarder nameservers for dnsmasq from ppp.
> - If I poff, it removes the forwarders nameservers from ppp.
> - If I ifup a static interface and I'm at home, it knows to use
>   192.168.1.1 as the nameserver dnsmasq forwards to. ifdown the
>   interface and it removes that name server.
> - If I run dhcpcd (or if ifup does), it automatically uses whatever name
>   server dhcp wants it to and the forwarder for dnsmasq.
> - If I down an interface I dhcp'd, it *removes the nameserver added
>   by dhcp*.
> - If I bring down all interfaces except lo, then dnsmasq is still running,
>   but has no forwarders at all. Actually quite useful for disconnected
>   work.
> 
> - No matter what I do, resolv.conf always has my local dnsmasq server at
>   the top of it.
> - No matter what I do, it always searches the same domain name, because
>   I want it to do that.
> - No matter where I go, nothing ever resolves to 64.94.110.11.
> 
> It's like magic. Editing /etc/resolv.conf back after dhclient stomped
> all over it was getting very old. Now I don't even need to think about
> it.
> 
> This kind of integration is one of my favorite things about Debian, and
> I doubt you'll find it anywhere else. Well, for a year or two..
> 
> -- 
> see shy jo

I'll try to grok it!  If you'll notice, my patch always writes 127.0.0.1
to resolv.conf, no matter what.  I went with my hack without spending the
hour learning resolvconf et al because quite frankly, the fewer "moving parts",
the easier it is for me to understand.

I don't have a laptop, but with my little 2-line patch resolv.conf ALWAYS has
only 127.0.0.1, and if I down eth0 dnsmasq always times out immediately.  But I
am sure I am speaking from ignorance -- when I get into a laptop situation, I'll
probably hit the problems you were describing.

I'll try to learn it!



Reply to: