如何使用自定义选项启动 Ubuntu dnsmasq DNS 服务器?我简单地这样启动它:
dnsmasq --log-async --log-queries
但是,我无法再访问 Google Drive:
无法访问此网站
找不到 drive.google.com 的服务器 DNS 地址。
$ dig drive.google.com
; <<>> DiG 9.10.3-P4-Ubuntu <<>> drive.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 44767
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;drive.google.com. IN A
;; Query time: 0 msec
;; SERVER: 192.168.2.102#53(192.168.2.102)
;; WHEN: Sat Sep 30 13:30:35 EDT 2017
;; MSG SIZE rcvd: 34
我猜 Ubuntu 应该也提供了一些默认的 dnsmasq 选项,对吧?那怎么办呢?谢谢。
答案1
找到了正确的方法,
$ printf 'log-queries\nlog-async\nmax-cache-ttl=10800\n' | sudo tee /etc/dnsmasq.d/dnsmasq.cache.conf
log-queries
log-async
max-cache-ttl=10800
$ sudo /etc/init.d/dnsmasq restart
[ ok ] Restarting dnsmasq (via systemctl): dnsmasq.service.
$ dig drive.google.com
;; QUESTION SECTION:
;drive.google.com. IN A
;; ANSWER SECTION:
drive.google.com. 299 IN A 172.217.2.110
;; Query time: 37 msec
;; SERVER: 192.168.2.102#53(192.168.2.102)
;; WHEN: Thu Oct 05 22:26:45 EDT 2017
;; MSG SIZE rcvd: 61