dnsmasq如何配置实现我已有配置的域名最先走指定的解析ip,已配置的域名中走已配置的dns,已配置的域名以上解析不通才走114.114.114.114。而且其他域名无法执行解析操作。类似白名单功能
dnsmasq如何配置实现我已有配置的域名最先走指定的解析ip,已配置的域名中走已配置的dns,已配置的域名以上解析不通才走114.114.114.114。而且其他域名无法执行解析操作。类似白名单功能
单个Dnsmasq服务可能无法实现。
为单个域名指定DNS
-S, --local, --server=[/[<domain>]/[domain/]][<server>[#<port>]]@<interface>]
Specify upstream servers directly. Setting this flag does not suppress reading of /etc/resolv.conf, use --no-resolv to do that. If one or more optional domains are given, that server is used only for those domains and they are queried only using the specified server. This is intended for private nameservers: if you have a nameserver on your network which deals with names of the form xxx.internal.thekelleys.org.uk at 192.168.1.1 then giving the flag --server=/internal.thekelleys.org.uk/192.168.1.1 will send all queries for internal machines to that nameserver, everything else will go to the servers in /etc/resolv.conf.
例子
server=/example.com/1.2.3.4
要按顺序解析
-o, --strict-order
By default, dnsmasq will send queries to any of the upstream servers it knows about and tries to favour servers that are known to be up. Setting this flag forces dnsmasq to try each query with each server strictly in the order they appear in /etc/resolv.conf
所以你需要配置Dnsmasq将指定域名的DNS指向另一个DNS服务器(例如另一个Dnsmasq服务),然后在那个DNS服务器上设置DNS查询的顺序。
7 回答5.4k 阅读
4 回答4.5k 阅读✓ 已解决
1 回答3.3k 阅读✓ 已解决
4 回答4.1k 阅读
2 回答5.9k 阅读✓ 已解决
3 回答2.2k 阅读✓ 已解决
2 回答1.6k 阅读✓ 已解决
在 dnsmasq 配置文件(/etc/dnsmasq.conf)这样配置一下就好了: