/etc/resolv.conf中设置dns之后每次重启Ubuntu Server时该文件会被覆盖,针对这种情况找了一些个解决方法

防止/etc/resolv.conf被覆盖的方法

方法一

1.需要创建一个文件/etc/resolvconf/resolv.conf.d/tail

sudo vi /etc/resolvconf/resolv.conf.d/tail

2.在该文件中写入自己需要的dns服务器,格式与/etc/resolv.conf相同

nameserver 8.8.8.8

3.重启下resolvconf程序

sudo /etc/init.d/resolvconf restart

再去看看/etc/resolv.conf文件,可以看到自己添加的dns服务器已经加到该文件中

方法二

在/etc/network/interfaces中

###interfaces中#######
auto eth0
iface eth0 inet static
address 192.168.3.250
netmask 255.255.255.0 #子网掩码
gateway 192.168.3.1 #网关
dns-nameservers 8.8.8.8 8.8.4.4 #设置dns服务器

Ubuntu Server 中resolv.conf重启时被覆盖的问题的更多相关文章

  1. Ubuntu Server 中实际内存与物理内存不相等的问题

    记录 来源 v2ex,提到了一个平时不是很起眼的问题,Ubuntu Server 中系统默认会占用 128M 内存,用于 CVM 内部的 kdump 服务. 科普 查看 CVM 所拥有的物理内存 通过 ...

  2. Ubuntu Server中怎样卸载keepalived

    场景 在Ubuntu Server中进行安装keepalived ,如果安装过程中出现纰漏,想要重新安装keepalived或者就是想直接卸载keepalived. 我们在安装keepalived时指 ...

  3. Ubuntu更改 resolv.conf 重启失效

    更改Ubuntu的 resolv.conf的时候,重启的时候,经常又给重置了.google大法找到方法. sudo apt-get install resolvconf  原来Ubuntu的resol ...

  4. Ubuntu 修改 /etc/resolv.conf 被清空 或重启不生效解决

    sudo gedit /etc/NetworkManager/NetworkManager.conf 注释掉 dns=dnsmasq [main] plugins=ifupdown,keyfile,o ...

  5. CentOS 修改/etc/resolv.conf 重启network后又恢复到原来的状态?

    问题描述:CentOS 修改/etc/resolv.conf 执行service network restart后,/etc/resolv.conf又恢复到原来的状态 解决方法:/etc/resolv ...

  6. Ubuntu 下 /etc/resolv.conf文件总是自动清除问题的解决方案

    最近学习Linux,在虚拟机中安装的是Ubuntu操作系统,用了几天发现Ubuntu无法上网,打开命令终端,输入命令: ping www.baidu.com -c2 结果显示名称无法识别,而直接与宿主 ...

  7. 如何在Ubuntu server中修改IP

    详细请移步至博客https://blog.csdn.net/shenzhen_zsw/article/details/74025066 方法一. sudo  ifconfig eth0 100.100 ...

  8. 在Ubuntu Server 中安装图形用户界面

    使用ubuntu server安装lamp主机非常的方便,只要在安装系统的步骤中选择就是了 .但是很多时候我需要在图形界面下管理主机更加方便.今天的教程就是教大家安装图形界面. 首先你需要确定你的源文 ...

  9. Ubuntu Server 上在安装Nginx时执行./confgiure后提示:C compiler cc is not found

    场景 Ubuntu Server 16.04 LTS上怎样安装下载安装Nginx并启动: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/detai ...

随机推荐

  1. Objective-C 【点语法】

    ------------------------------------------- 点语法的使用 // //  点语法的使用 // //  点语法:   xcode的一种特性,xcode帮我们做代 ...

  2. 从客户端中检测到有潜在危险的 request

    如题,当遇到这种情况该怎么办呢? 通常情况下一下2种解决方案就可以解决问题了:    解决方案一:     在.aspx文件头中加入这句:     <%@ Page validateReques ...

  3. java新手笔记28 文件

    1.目录.文件 package com.yfs.javase; import java.io.File; public class FileDemo1 { /** * File 目录 文件 */ pu ...

  4. FileZilla ftp服务器安装

    在官网下载server版本的FileZilla,我下载的是(The latest stable version of FileZilla Server is 0.9.41) 然后直接安装就可了,我由于 ...

  5. ubuntu启动慢

    http://blog.sina.com.cn/s/blog_4cc9ffbc0100rxhh.html 参考 笔记本装的是ubuntu12.04,最近发现开机启动特别慢,至少3分钟,总担心系统会启动 ...

  6. php parallel

    http://www.phpied.com/simultaneuos-http-requests-in-php-with-curl/ http://stackoverflow.com/question ...

  7. [原创] linux课堂-学习笔记-课程3.Linux目录结构介绍及内核与shell分析

    一.目录说明 1.1 bin 一般用户,可执行的系统内置命令 1.2 sbin 系统管理员,可执行的系统内置命令 1.3 boot 启动文件目录,启动有关的文件都保存在此 1.4 dev 设备管理文件 ...

  8. PHP发起get post put delete请求

    <?php class commonFunction{ function callInterfaceCommon($URL,$type,$params,$headers){ $ch = curl ...

  9. google其他入口地址

    http://178.45.251.74/ http://64.233.166.51/ http://61.19.1.117/ http://64.233.166.42/ http://61.19.1 ...

  10. MySQL Connector Net连接vs2012问题

    最近做一.NET项目,数据库用到MySQL,可是在VS2012连接数据库是遇到问题,提示:Authentication with old password no longer supported, u ...