ubuntu server 12.10 set dnsnameserver config by interface avoid auto overwrite by direct edit from /etc/resolv.conf

It’s probably better to have your DNS server be able to resolve ‘puppet’ to the right address, and have your DHCP server hand out the DNS information, or if you have static IP addresses, something like this.

iface eth0 inet static
address 192.168.3.3
netmask 255.255.255.0
gateway 192.168.3.1
dns-search example.com
dns-nameservers 192.168.3.45 192.168.8.10

But if you do want to do it via the resolv.conf file, wou will want to edit

/etc/resolvconf/resolv.conf.d/head
In that file, after the header, put in your info like you would in resolv.conf

nameserver 192.168.1.XXX

Then restart resolvconf

sudo resolvconf -u

建議:

Ubuntu 12.10 DNS 設定盡量在 /etc/network/interfaces 設定檔中設定「dns-nameservers」參數值(可用空白區隔多個IP位址)。

如果想由 nameserver=x.x.x.x 的方式設定DNS,可以直接在「/etc/resolvconf/resolv.conf.d/head」寫入之後需重新啟動或更新 resolvconf 。

廣告

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s