星期三, 4月 30, 2008

Gentoo 下的 DNS 設定(Modular Network)

Gentoo 下,設定網路是那麼容易也那麼的不容易。不經大腦的把 /etc/conf.d/net 砍掉的話,一切就使用美好的預設設定。但是若要更改一點點東西,就很令人 OOXX。

最近想把 dns server 換成 OpenDNS,但是每次 dhcp 跟 ppp 都把我的 resolv.conf 亂改成自己想要的內容(如 192.168.1.1 或 hinet dns),真是令人火大。

好在有 openresolv 這個好東西,裝了以後就沒煩惱了!雖說這個主要是給 vpn 用的...

首先安裝:

# emerge openresolv

然後設定:

# echo -e 'nameserver 208.67.222.222\nnameserver 208.67.220.220' | resolvconf -a $INTERFACE

請把 $INTERFACE 換成您的 interface,如 eth0 或 ppp0:

# echo -e 'nameserver 208.67.222.222\nnameserver 208.67.220.220' | resolvconf -a eth0
# echo -e 'nameserver 208.67.222.222\nnameserver 208.67.220.220' | resolvconf -a ppp0

然後讓他更新:

# resolvconf -u

這麼一來,就可以用 OpenDNS 查 domain name 了!

# host -v palatis.iiiii.info
Trying "palatis.iiiii.info"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55262
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;palatis.iiiii.info. IN A

;; ANSWER SECTION:
palatis.iiiii.info. 28 IN A 220.141.34.251

Received 52 bytes from 208.67.222.222#53 in 157 ms
Trying "palatis.iiiii.info"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14133
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;palatis.iiiii.info. IN AAAA

Received 36 bytes from 208.67.222.222#53 in 156 ms
Trying "palatis.iiiii.info"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16198
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;palatis.iiiii.info. IN MX

Received 36 bytes from 208.67.222.222#53 in 168 ms

沒有留言: