Centos6.5 永久修改DNS位址的方法
1、配置ip位址檔案 /etc/sysconfig/network-scripts/ifcfg-eth0
添加一行
<code>DNS1=</code><code>8.8</code><code>.</code><code>8.8</code> <code>#手動添加一個dns位址;</code>
DNS配置檔案/etc/resolv.conf 的位址會自動比對手動添加的位址;重新開機網卡後不會清除;
2、手動添加dns位址 DNS配置檔案 /etc/resolv.conf
<code>nameserver </code><code>8.8</code><code>.</code><code>8.8</code>
配置ip位址檔案 /etc/sysconfig/network-scripts/ifcfg-eth0
添加
<code>PEERDNS=no #添加後不會去打擾 /etc/resolv.conf 檔案</code>
DHCP環境下,在/etc/resolv.conf 手動添加dns位址後,重新開機網卡,會自動清除;添加到/etc/sysconfig/network-scripts/ifcfg-eth0的dns位址不會清除;
靜态配置IP的環境下,/etc/resolv.conf 手動添加dns位址,重新開機後不會清除;
本文轉自謝育政 51CTO部落格,原文連結:http://blog.51cto.com/kurolz/1860949,如需轉載請自行聯系原作者