How to solve the loss problem after Centos modifies DNS restart or restarts the network service

Source: Internet
Author: User
Tags nameserver

How to solve the loss problem after Centos modifies DNS restart or restarts the network service
Read directory introduction cause processing GitHub introduction when we configure Centos, we need to be able to connect to the Internet in many cases, so we need the DNS resolution function. By default, DNS information is not configured, so we have to configure DNS information. When we search for Centos to configure DNS information, many of them refer to configuring "/etc/resolv in this file. conf ", we can ping the domain name after adding the nameserver in it, but it cannot be pinged after restarting centos or the network service. In"/etc/resolv. conf "the configured nameserver information is also lost. After processing, find the corresponding Nic configuration file "/etc/sysconfig/network-scripts/ifcfg-eth <N>" where <N> can be 0, 1, 2, etc, indicates the configuration file of different NICs. For example, if the first network adapter in the system is eth0, its configuration file is/etc/sysconfig/network-scripts/ifcfg-eth0. Vim/etc/sysconfig/network-scripts/ifcfg-eth0 open and insert the following 3 PEERDNS = noDNS1 = 192.168.1.1DNS2 = 192.168.1.2 and then: wq save and then we review the "/etc/resolv. conf "cat/etc/resolv. conf finds the DNS information we modified in the ifcfg-eth0 in resolv. as you can see in conf, this is why columns, because resolve. conf is only a link file. Then we can see the effect of ping www.baidu.com. Then we restart the network service network restart. Then we can find that there is no problem under ping. Then we can restart the system reboot. The result is exactly what we expected.

Related Article

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.