Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to setup dnsmasq to accelerate DNS resolving , but since i use a PPPoE connection , there're both dns server provided by ISP , and the

So how can i place the local dns server as the first line in /etc/resolv.conf automatically ? And please don't let me use a static dns server configuration ..

Thanks !

share|improve this question
up vote 3 down vote accepted

You don't need to list any nameserver other than in /etc/resolv.conf. What you need to inform dnsmasq of the upstream DNS server, and it will relay and cache requests to the ISP's server.

If your ISP's DNS providers don't change (they rarely do), you can declare them in the Dnsmasq configuration file (/etc/dnsmasq.conf), with lines like server= If your ppp or dhcp daemon drops the addresses of your ISP's providers in a file, say /etc/ppp/resolv.conf, then reference that file in dnsmasq.conf: resolv-file=/etc/ppp/resolv.conf.

You'll find instructions for most common setups in the Dnsmasq setup documentation, and the complete list of options in the example configuration file.

If you're running Debian, Ubuntu or some other distribution with a resolvconf package, install it. Resolvconf automatically manages adding and removing entries from the DNS configuration when you connect or disconnect to a network.

share|improve this answer
Very impressive , I've been misunderstanding for the concept for a while , right , only localhost should appear in /etc/resolv.conf. Thanks ! – warl0ck Jan 4 '12 at 0:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.