Ubuntu Configuring multiple DNS

Source: Internet
Author: User
Tags one more line nameserver

Ubuntu set a static IP address, set up DNS, open/etc/resolv.conf

Cat/etc/resolv.conf
# Dynamic resolv.conf (5) file for glibc resolver (3) generated by resolvconf (8)
# do not EDIT this FILE by HAND--YOUR changes'll be overwritten

This section warns that this file is created dynamically by the RESOLVCONF program and is not recommended to be edited directly, and the modified value may be overwritten.

Sure enough, the restart will fail after the change.

There are two ways of setting up DNS:

method One: through/etc/network/interfaces, at the end of it add a sentence (multiple DNS separated by a space):

Dns-nameservers 202.97.224.68 202.97.224.69

202.97.224.68 is a DNS service for Unicom. DNS will take effect after reboot, at which point the/etc/resolv.conf file will have one more line:

# Dynamic resolv.conf (5) file for glibc resolver (3) generated by resolvconf (8)
# do not EDIT this FILE by HAND--YOUR changes'll be overwritten
NameServer 202.97.224.68
NameServer 202.97.224.69

method Two : by modifying the/etc/resolv.conf (this file is empty by default)

Insert Inside:
NameServer 202.97.224.68
NameServer 202.97.224.69

If you have multiple DNS, one line

Modify the Save and then execute:

Resolvconf-u

Look at/etc/resolv.conf, the bottom is more than 2 lines:

Cat/etc/resolv.conf
# Dynamic resolv.conf (5) file for glibc resolver (3) generated by resolvconf (8)
# do not EDIT this FILE by HAND--YOUR changes'll be overwritten
NameServer 202.97.224.68
NameServer 202.97.224.69

You can see that the set of multiple DNS has been added, and then ping Baidu, immediately can be resolved without restarting.

Ubuntu Configuring multiple DNS

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.