The example in this article describes the CentOS 6.6 implementation method for permanently modifying DNS addresses. Share to everyone for your reference, specific as follows:
1. Configure IP address file /etc/sysconfig/network-scripts/ifcfg-eth0
Add a line:
Copy Code code as follows:
dns1=8.8.8.8 #手动添加一个dns地址;
The address of the DNS profile/etc/resolv.conf will automatically match the manually added address, and will not be purged after the network card is restarted;
2. Add DNS Address manually
DNS configuration file/etc/resolv.conf
Copy Code code as follows:
Configure IP Address file/etc/sysconfig/network-scripts/ifcfg-eth0
Add to:
Copy Code code as follows:
Peerdns=no #添加后不会去打扰/etc/resolv.conf File
In a DHCP environment, when/etc/resolv.conf manually add a DNS address, the network adapter is automatically removed, and the DNS address added to/etc/sysconfig/network-scripts/ifcfg-eth0 is not cleared;
Static configuration of IP environment,/etc/resolv.conf Manually add DNS address, reboot will not clear.
I hope this article will help you CentOS server management.