Modify DNS in Linux and dns in linux

Source: Internet
Author: User

Modify DNS in Linux and dns in linux

Not long ago, I encountered some problems on the server. I need to modify the dns configuration of the server and write it down. I used centos 6.5.

The DNS configuration file is in/etc/resolv. conf, but the service network restart is restarted after modification. If it is opened again, the configuration file is restored.

This is the 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 to the ifcfg-eth0, and then add the 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

 

Edit the configuration file/etc/resolv. conf again and add a line of namerserver xxx. xx
Nameserver 222.46.120.6

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.