In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
The purpose of this article is to share with you the content of the sample analysis in which the DNS information in resolv is automatically modified after linux6 restart. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The / etc/resolv.conf of linux 6 is modified after restart because if the NetworkManager service starts automatically during restart, the service will read the NM_CONTROLLED and DNS configuration in the network card information. If NM_CONTROLLED=yes is configured in the network card, if DNS is configured in the network card, the DNS in the network card will be written to resolv.conf. If the network card is not configured with DNS, the empty DNS information will be written to resolv.conf.
If you do not want the / etc/resolv.conf to be modified when restarting, shut down the NetworkManager service service NetworkManager stop
Chkconfig-level 0123456 NetworkManager off
And modify the network card NM_CONTROLLED=no
That is to say, when restarting, if there is a Network Manager service and the network card is configured with a Network Manager service, the service will modify / etc/resolv.conf according to the DNS of the network card.
As for the DNS configuration in the network card, it is not necessary to configure every network card with IP, as long as one of them is configured with DNS, because DNS is shared, but DNS must be configured on the network card with IP. If there are many network cards but there is no IP, even if these network cards are configured with DNS, / etc/resolv.conf will not obtain the DNS after restart.
Failure phenomenon 1 the nameserver information set in ZhonetcUniverse V.conf is lost.
[root@bsdb ~] # cat / etc/resolv.conf
# Generated by NetworkManager
# No nameservers found; try putting DNS servers into your
# ifcfg files in / etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
Check the file properties and find that the file has been modified
[root@bsdb ~] # ll / etc/resolv.conf
-rw-r--r--. 1 root root 228 June 19 11:06 / etc/resolv.conf
Found that the file modification time and restart time match
[root@bsdb ~] # last | grep reboot
Reboot system boot 2.6.32-431.el6.x Tue Jun 19 11:06-11:27
Check the IP of the network card
[root@bsdb ~] # grep IPADDR / etc/sysconfig/network-scripts/ifcfg-eth*
/ etc/sysconfig/network-scripts/ifcfg-eth0:IPADDR=192.168.21.16
/ etc/sysconfig/network-scripts/ifcfg-eth4:IPADDR=192.167.120.11
Check the DNS information of the network card. There is no DNS configured.
[root@bsdb ~] # grep DNS / etc/sysconfig/network-scripts/ifcfg-eth*
/ etc/sysconfig/network-scripts/ifcfg-eth2:PEERDNS=yes
/ etc/sysconfig/network-scripts/ifcfg-eth3:PEERDNS=yes
/ etc/sysconfig/network-scripts/ifcfg-eth5:PEERDNS=yes
/ etc/sysconfig/network-scripts/ifcfg-eth6:PEERDNS=yes
Check to see if the network card has NetworkManager management enabled, that is, NM_CONTROLLED=yes
[root@bsdb ~] # grep NM_CONTROLLED / etc/sysconfig/network-scripts/ifcfg-eth*
/ etc/sysconfig/network-scripts/ifcfg-eth0:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth2:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth3:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth4:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth5:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth6:NM_CONTROLLED=yes
Check to see if NetworkManager is running
[root@bsdb ~] # service NetworkManager status
NetworkManager (pid 6297) is running...
OS version
[oraprod@bsdb ~] $cat / etc/issue
CentOS release 6.5 (Final)
Malfunction phenomenon 2 the nameserver set in ZhonetcUniverse V.conf has been modified.
[root@lmdb ~] # cat / etc/resolv.conf
# Generated by NetworkManager
Nameserver 192.168.30.50
Nameserver 192.168.130.50
Check the file properties and find that the file has been modified
[root@lmdb ~] # ll / etc/resolv.conf
-rw-r--r--. 1 root root 81 June 19 11:04 / etc/resolv.conf
Found that the file modification time and restart time match
[root@lmdb ~] # last | grep reboot
Reboot system boot 2.6.32-642.el6.x Tue Jun 19 11:04-10:09 (1mm 2304)
Check the IP of the network card
[root@lmdb ~] # grep IPADDR / etc/sysconfig/network-scripts/ifcfg-eth*
/ etc/sysconfig/network-scripts/ifcfg-eth0:IPADDR=192.168.148.200
/ etc/sysconfig/network-scripts/ifcfg-eth2:IPADDR=192.168.130.200
Check the DNS information of the network card, configure DNS, and configure DNS is one of the network cards with IP
[root@lmdb ~] # grep DNS / etc/sysconfig/network-scripts/ifcfg-eth*
/ etc/sysconfig/network-scripts/ifcfg-eth0:PEERDNS=yes
/ etc/sysconfig/network-scripts/ifcfg-eth2:DNS1=192.168.30.50
/ etc/sysconfig/network-scripts/ifcfg-eth2:DNS2=192.168.130.50
/ etc/sysconfig/network-scripts/ifcfg-eth2:PEERDNS=yes
/ etc/sysconfig/network-scripts/ifcfg-eth3:PEERDNS=yes
/ etc/sysconfig/network-scripts/ifcfg-eth4:PEERDNS=yes
/ etc/sysconfig/network-scripts/ifcfg-eth5:PEERDNS=yes
/ etc/sysconfig/network-scripts/ifcfg-eth6:PEERDNS=yes
Check to see if the network card has NetworkManager management enabled, that is, NM_CONTROLLED=yes
[root@lmdb ~] # grep NM_CONTROLLED / etc/sysconfig/network-scripts/ifcfg-eth*
/ etc/sysconfig/network-scripts/ifcfg-eth0:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth2:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth3:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth4:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth5:NM_CONTROLLED=yes
/ etc/sysconfig/network-scripts/ifcfg-eth6:NM_CONTROLLED=yes
Check to see if NetworkManager is running
[root@lmdb ~] # service NetworkManager status
NetworkManager (pid 3173) is running...
OS version
[root@lmdb ~] # cat / etc/issue
CentOS release 6.8 (Final)
Kernel\ r on an\ m
Thank you for reading! This is the end of the article on "sample analysis of automatic modification of DNS information in resolv after linux6 restart". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.