Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of / etc/resolv.conf being reset after CentOS 7.4 restart?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

How to solve the problem that/etc/resolv.conf is reset after CentOS 7.4 restart? I believe that many novice white helpless, through the summary of this article, I hope you can find a solution.

The server/etc/resolv.conf file for cloud resources was originally configured as follows:

Solution: /etc/resolv.conf saves DNS temporarily. When restarting the network,/etc/resolv.conf returns to its initial state. To change it, try the following method.

The requested URL/etc/sysconfig/network-scripts/ifcfg-eth0 was not found on this server.

Add the DNS you want to add, as shown below.

After saving and exiting, execute server network restart, then the DNS information you just added in ifcfg-eth0 will be automatically added to/etc/resolv.conf (as shown below), and the restart will still be effective.

II. Modify the network card configuration and add "PEERDNS=no"

Save exit, execute server network restart, the original two "

search openstacklocal

nameserver 114.114.114.114

"Parameters are missing, only the DNS information you just added in ifcfg-eth0 will be automatically added to/etc/resolv.conf (as shown below), and the restart is still valid.

Third, do not need dns words, as long as the increase of "PEERDNS=no" parameter, restart the network card resolv.conf file is empty, as shown in the following figure:

thus concluded

Outside:

In Linux, the DNS configuration file is located in/etc/resolv.conf, which mainly has three fields, namely nameserver, domain, search.

Let's take a brief look at the following examples:

# Generated by NetworkManagerdomain example.comsearch example.comnameserver 192.168.1.100

Here domain and search are a function, and the former fails when both exist.

When a domain name cannot be resolved by DNS, the resolver will add the parameters specified by search to the domain name and re-request DNS until it is resolved correctly or the list specified by search is tried.

After reading the above, do you know how to solve the problem of/etc/resolv.conf being reset after CentOS 7.4 restart? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report