如何自动添加localhost DNS服务器(dnsmasq)到resolv.conf

我在https://wiki.archlinux.org/index.php/OpenVPN#DNS做了一些步骤,用OpenVPN设置DNS,以便OpenVPN在连接或断开连接时自动更新/etc/resolv.conf

问题是我也有一个DNS服务器(dnsmasq)在本地主机上运行来parsing某些自定义域,我想将这些条目添加到生成的/etc/resolv.conf。 我怎样才能做到这一点?

我尝试在/etc/resolvconf.conf取消注释name_servers=127.0.0.1行,但是生成的/etc/resolv.conf 包含那一行,而不是将其追加到最后。

我碰到的东西也。

Resolvconf可以生成 dnsmasq可以读取的 configuration 。

join你的resolvconv.conf

 dnsmasq_resolv=/etc/dnsmasq-resolv.conf 

然后到你的dnsmasq.conf

 resolv-file=/etc/dnsmasq-resolv.conf 

这样,resolvconf会把dnsmasq的dns服务器写在一个特殊的configuration文件中,而不是从/etc/resolv.conf读取dnsmasq。