[Switch] resolv. conf configuration information lost after restart Solution

Source: Internet
Author: User
Tags nameserver

I want to configure DNS, modify/etc/resolv. conf, restart service network restart after modification, and modify/etc/resolv. conf. The information is lost. Please take a look.

Configuration before modification
# No nameservers found; try putting DNS servers into your
# Ifcfg files in/etc/sysconfig/network-Scripts like so:
#
# Dns1 = XXX. XXX
# Dns2 = XXX. XXX
# Domain = lab.foo.com bar.foo.com

 

Solution: Add dns1 = XXX. XXX directly in the ifcfg-eth0, and then Service Network restart

Device = "eth0 ″
Bootproto = "static"
Hwaddr = "00: 0C: 29: B5: e4: 65 ″
Nm_controlled = "yes"
Onboot = "yes"
Ipaddr = 192.168.128.20.
Netmask = 255.255.255.0
Gateway = 192.168.128.1
Dns1 = 222.46.120.6

 

Check that resolv. conf has one more namerserver XXX. XX.
# Generated by NetworkManager
Nameserver 222.46.120.6

Method 2:

Finally found an article to solve my problem: http://tech.techweb.com.cn/archiver/tid-380658.html
Article content:
Vim/etc/resolvconf/resolv. conf. d/head File
Display the same content as resolv. conf:
# Dynamic resolv. conf (5) file for glibc resolver (3) generated by resolvconf (8)
# Do not edit this file by hand-your changes will be overwritten)
Enter nameserver 202.102.152.3
Save and exit,
Resolvconf-u
In this case, you can access the Internet normally. After restarting, you do not need to reset the DNS.

[Switch] resolv. conf configuration information lost after restart Solution

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.