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

Re: prepend localdns to resolv.conf - keeps changing



On Fri, Mar 28, 2014 at 04:41:03PM +0200, Roland RoLaNd wrote:
>    All,
>    I installed dnsmasq on a production web server to improve caching (we tend
>    to resolve alot of domains while serving pages) 
>    my problem is that we have to use dhcp with the server, so cannot use
>    static ips.
>    with that in mind, the dhcpd client keeps overriding my resolv.conf
>    i can't lock the file as the dns provided by the dhcp service may change
>    (i don't have control over it) so what i need is the following;
>    nameserver 127.0.0.1
>    nameserver  (ip provided by the dhcp service)

No, you probably don't. Read the man page on resolv.conf:

       nameserver Name server IP address
              Internet  address  of  a name server that the resolver should query, either an IPv4
              address (in dot notation), or an IPv6 address in colon (and possibly dot)  notation
              as  per  RFC  2373.   Up to MAXNS (currently 3, see <resolv.h>) name servers may be
              listed, one per keyword.  If there  are  multiple  servers,  the  resolver  library
              queries  them  in  the  order  listed.   If  no nameserver entries are present, the
              default is to use the name server on the local machine.  (The algorithm used is  to
              try  a  name  server,  and  if the query times out, try the next, until out of name
              servers, then repeat trying all the name servers until a maximum number of  retries
              are made.)

In other words, do all your lookups through the caching nameserver.
It'll have the side-effect that even more addresses get cached.

Attachment: signature.asc
Description: Digital signature


Reply to: