"Ubuntu" Ubuntu network configuration DNS invalidation problem processing

Source: Internet
Author: User
Tags nameserver

An Ubuntu server version is installed, a static IP address is configured, and DNS is configured. However, after the restart, it is found that there is still a problem when connecting the outside network.

Look for a bit, is the problem of DNS.

This can be handled:

cat /etc/network/192.168. 21.11  255.255. 255.0  192.168. 21.1 dns-nameservers 8.8.8.8

Note that the key is that the last line needs to be configured here.

I was previously configured in/etc/resolv.conf, but the reboot will be lost.

Problem Analysis:

Looking back at/etc/resolv.conf, we'll find that the description is:

cat /etc/resolv.conf# Dynamic resolv.conf (5file for glibc Resolver (  3) generated by resolvconf (8) #     --YOUR changes'll be overwritten

This means: This file is dynamically created by the RESOLVCONF program, do not edit directly, the changes will be overwritten.

The same goes for the fact that the restart fails after the change.

Search the Ubuntu set up the DNS information, summed up two ways:

Method One, modify/etc/network/interfaces

By/etc/network/interfaces, add a sentence at the end of it:

Dns-nameservers 8.8.8.8

8.8.8.8 is a DNS service provided by Google, just to cite an example, you can also change to the DNS of the carrier. DNS is in effect after reboot.

Method two, modify/etc/resolvconf/resolv.conf.d/base

Modified By:/etc/resolvconf/resolv.conf.d/base (this file is empty by default)

Insert Inside:
NameServer 8.8.8.8
NameServer 8.8.4.4

If there are multiple DNS, one line at a.

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 (5file for glibc Resolver (  3) generated by resolvconf (8) #     --8.8.  8.88.8. 4.4

Can see that our settings have been added, and then ping a domain name, then can be resolved without restarting.

Report:

It is much easier to modify DNS under CentOS, and to modify/etc/resolv.conf directly, the content is:
NameServer 8.8.8.8
NameServer 8.8.4.4

Save is effective, and restarting is no problem.

"Ubuntu" Ubuntu network configuration DNS invalidation problem processing

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.