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.