Why is resolv. conf always cleared in centos6?

Source: Internet
Author: User
Tags ftp connection nameserver
In centos6, why is resolvconf always cleared? recently, the virtual machine virtualbox is installed on the machine, centos64 is installed, the free host control panel virtualmin is installed, and a test website is built on the local machine. Everything went smoothly and the website was running normally. But why resolv in centos6 the next day. conf is always cleared. recently, the virtual machine virtualbox is installed on the machine, centos6.4 is installed, the free host control panel virtualmin is installed, and a test website is built on the local machine. Everything went smoothly and the website was running normally. However, when the machine was started again the next day, it was found that ftp could not be connected, and the timeout occurred. So I checked the ftp server process and found that the proftp process was not started. You can find the problem and enter the command to start it. Then, enter service proftpd start, but the startup fails. the prompt is "unable to determine IP address of" hostbus.net ". So Baidu Google found that the cause of proftpd startup failure was that the virtual machine could not resolve the host's IP address. the solution was to add the local return address 127.0.0.1 to the DNS list, indicates that the "xxx.com" domain name is resolved by the local machine. Add method: if it is a graphical interface, you can directly modify it in network management, or open the file/etc/resolv. conf, add the following statement: if nameserver 127.0.0.1 is a text interface, use vi to open/etc/resolv. conf, add nameserver 127.0.0.1. Note: The nameserver must be a top-level server. do not leave spaces in front of the server. After this processing, the service proftpd start is successful and the ftp connection is normal. So I thought the problem was solved. After the machine is restarted again, it is found that ftp cannot be connected, and the problem is exactly the same as the previous one. Check the configuration file/etc/resolv. conf and find that the last modification has been cleared. It's really strange. it was changed manually. how can it disappear? After a long time on virtualmin, I did not find the cause. then I searched the search engine and found that many people encountered this problem. linux of different systems had this problem, this problem occurs in centos from 5.6. Among the many answers, I finally found the cause:/etc/resolv. conf is cleared because no dns server information exists in/etc/sysconfig/network-scripts/ifcfg-eth0, so after the restart, the system automatically uses the/etc/sysconfig/network-scripts/ifcfg-eth0 settings to reset/etc/resolv. conf, resulting in/etc/resolv modification. conf is invalid. Add nameserver information to/etc/sysconfig/network-scripts/ifcfg-eth0,/etc/resolv. conf does not need to be modified at all, the system will automatically set resolv according to the ifcfg-eth0 after the system restart or network restart. conf. Knowing the cause, the complete solution has: Open the ifcfg-eth0, add the following statement at the end: The following xxx with dns server address instead. DNS1 = xxx. xxx. xxx. xxxDNS2 = xxx. xxx. xxx. after xxx is saved, restart the network service: service network restart, and then enable/etc/resolv. conf, found that there is a nameserver, no need to manually modify resolv. conf. Resolv. conf is always cleared.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.