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 127.0.0.1.
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 !
Best Answer
You don't need to list any nameserver other than
127.0.0.1
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 likeserver=203.0.113.1
. 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 indnsmasq.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.