有趣的事

dnsmasq on Ubuntu

```
apt-get install dnsmasq
```


```
vim /etc/dnsmasq.conf
```


```
listen-address=127.0.0.1
bind-interfaces
cache-size=10000
log-queries
resolv-file=/etc/resolv.conf
```


```
vim /etc/default/dnsmasq
```


```
IGNORE_RESOLVCONF=yes
```


```
vim /etc/resolvconf/resolv.conf.d/tail
```


```
nameserver 114.114.114.114
nameserver 114.114.115.115
```


```
resolvconf -u
```


```
cat /etc/resolv.conf 
```


```
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
nameserver 114.114.114.114
nameserver 114.114.115.115
```


```
dig www.baidu.com
```


```
; <<>> DiG 9.8.1-P1 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15451
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.baidu.com.                 IN      A

;; ANSWER SECTION:
www.baidu.com.          678     IN      CNAME   www.a.shifen.com.
www.a.shifen.com.       29      IN      A       220.181.111.148
www.a.shifen.com.       29      IN      A       220.181.112.143

;; Query time: 8 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Dec  6 17:53:18 2013
;; MSG SIZE  rcvd: 90
```

然后可以在hosts里面写自己需要的解析。

dnsmasq UBUNTU

相关阅读