如何使用自訂選項啟動 Ubuntu dnsmasq DNS 伺服器?我簡單地開始它:
dnsmasq --log-async --log-queries
但是,我無法再訪問谷歌驅動器:
無法存取該網站
找不到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