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 !

1 Answer 1


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.

  • Very impressive , I've been misunderstanding for the concept for a while , right , only localhost should appear in /etc/resolv.conf. Thanks !
    – daisy
    Jan 4, 2012 at 0:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .