Ubuntu / CoreOS修改DNS配置
- 不要直接手动修改文件 /etc/resolv.conf
安装好Ubuntu之后设置了静态IP地址,再重启后就无法解析域名。想重新设置一下DNS,打开/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 WILL BE OVERWRITTEN
内容是一段警告:说这个文件是resolvconf程序动态创建的,不要直接手动编辑,修改将被覆盖。
root@Ubuntu14:~# 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 WILL BE OVERWRITTEN
nameserver 100.100.2.138
nameserver 100.100.2.136
options timeout:2 attempts:3 rotate single-request-reopen
root@Ubuntu14:~#
ubuntu修改DNS有如下两种方法。
- 方法一:修改文件/etc/resolvconf/resolv.conf.d/base
root@Ubuntu14:~# 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 WILL BE OVERWRITTEN
nameserver 100.100.2.138
nameserver 100.100.2.136
options timeout:2 attempts:3 rotate single-request-reopen
root@Ubuntu14:~# vim /etc/resolvconf/resolv.conf.d/base
root@Ubuntu14:~# cat !$
cat /etc/resolvconf/resolv.conf.d/base
nameserver 223.5.5.5
nameserver 223.6.6.6
root@Ubuntu14:~# resolvconf -u
root@Ubuntu14:~# 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 WILL BE OVERWRITTEN
nameserver 100.100.2.138
nameserver 100.100.2.136
nameserver 223.5.5.5
options timeout:2 attempts:3 rotate single-request-reopen
root@Ubuntu14:~# nslookup www.baidu.com
Server: 100.100.2.138
Address: 100.100.2.138#53 Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 220.181.112.244
Name: www.a.shifen.com
Address: 220.181.111.188 root@Ubuntu14:~#
- 方法二:修改文件 /etc/network/interfaces
root@iZbp1b66g5htibj2m7yyv3Z:~# cat /etc/network/interfaces auto lo
iface lo inet loopback auto eth0
iface eth0 inet dhcp dns-nameservers 223.5.5.5 # 在最后添加这一行
- 常用命令
linux刷新dns的缓存方法是: sudo /etc/init.d/nscd restart
最暴力的方法刷dns,重启网络: sudo /etc/init.d/networking restart
查看当前DNS解析情况:
nslookup www.baidu.com
dig | grep SERVER
root@iZbp1b66g5htibj2m7yyv3Z:~# /etc/init.d/nscd restart
* Restarting Name Service Cache Daemon nscd [ OK ]
root@iZbp1b66g5htibj2m7yyv3Z:~# /etc/init.d/networking restart
stop: Job failed while stopping
start: Job is already running: networking
root@iZbp1b66g5htibj2m7yyv3Z:~# dig |grep SERVER
;; SERVER: 100.100.2.138#53(100.100.2.138)
root@iZbp1b66g5htibj2m7yyv3Z:~# nslookup www.baidu.com
Server: 100.100.2.138
Address: 100.100.2.138#53 Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 220.181.111.188
Name: www.a.shifen.com
Address: 220.181.112.244 root@iZbp1b66g5htibj2m7yyv3Z:~#
- CoreOS修改DNS
1) vim /etc/resolv.conf
2) vim /etc/systemd/resolved.conf
3) systemctl restart systemd-resolved
4) reboot
coreos1 ~ # cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known DNS servers.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf. nameserver 223.5.5.5
nameserver 223.6.6.6
search openstacklocal
coreos1 ~ # cat /etc/systemd/resolved.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details [Resolve]
DNS=223.5.5.5 223.6.6.6 # 用空格分隔多个dns
#FallbackDNS=
#Domains=
LLMNR=no # yes改为no
#DNSSEC=allow-downgrade
#Cache=yes
coreos1 ~ # systemctl restart systemd-resolved
coreos1 ~ # dig |grep SERVER
;; SERVER: 223.5.5.5#53(223.5.5.5)
coreos1 ~ # reboot
Ubuntu / CoreOS修改DNS配置的更多相关文章
- Linux 如何查看修改DNS配置
DNS服务器介绍 DNS是计算机域名系统(Domain Name System 或Domain Name Service) 的缩写,它是由域名解析器和域名服务器组成的.域名服务器是指保存有该网络中所有 ...
- [转载]--Ubuntu下修改DNS重启也能用的方法
安装好Ubuntu之后设置了静态IP地址,再重启后就无法解析域名.想重新设置一下DNS,打开/etc/resolv.conf cat /etc/resolv.conf# Dynamic resolv. ...
- Ubuntu 14.04 DNS 配置
最近得到一个比较好用的DNS,每次重启后都修改DNS配置文件 /etc/resolv.conf 重启就会失效 从网上得知 /etc/resolv.conf中的DNS配置是从/etc/resolvcon ...
- Ubuntu怎么修改DNS
有时候会出现配置好网络之后,可以ping通网关却ping不通www.baidu.com orangepi@orangepi3:~$ ping 192.168.1.1 PING 192.168.1.1 ...
- ubuntu(Mint-17)修改dns
国内默认dns常被劫持,所以需要修改: $ sudo vi /etc/network/interfaces 在下面添加一行: dns-nameservers 8.8.8.8 8.8.4.4 然后,网上 ...
- Ubuntu下修改DNS重启也能用的方法
1.通过修改:/etc/resolvconf/resolv.conf.d/base(这个文件默认是空的)实现 内容填上需要修改的nameserver
- cmd命令快速修改dns
新建cmd文件,修改红色ip部分,以 ANSI 编码保存,双击运行即可快速修改dns配置 netsh interface ip set dns "本地连接" source=stat ...
- Cent OS 修改网卡配置
进入网卡修改界面 vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 描述网卡设备名称 BOOTPROTO=static 静态IP,这里一 ...
- CentOS 7设置静态IP并修改DNS
1. 设置静态IP 首先需要确定网线插在服务器的哪一个网络接口上,接口旁边一般都有写.我这边是插在1号接口上的. 然后修改网络配置文件,文件位于 /etc/sysconfig/network-scri ...
随机推荐
- 文件包含 & LFI-labs靶场
文件包含漏洞学习 冲冲冲,好好学习 2020.1.30 认真对待自己做出的每一个决定 知识与实践 Q:什么是文件包含? A:简单一句话,为了更好地使用代码的重用性,引入了文件包含函数,可以通过文件包含 ...
- 「Leetcode-算法_Easy461」通过「简单」题目学习位运算
Easy 461.汉明距离 因为原题目翻译效果不佳,这里是笔者自己的理解. 输入两个二进制数 x.y, 输出将 y 变为 x 所需改变的二进制位数,成为汉明距离. 注意: 0 ≤ x, y < ...
- 网安日记④之搭建域环境(domain)并且配置域
搭建域环境(domain)并且配置域 什么是域 域就是将多台计算机在逻辑上组织到一起,进行集中管理,也就是创建在域控制器上的组,将组的账户信息保存在活动目录中.域组可以用来控制域内任何一台计算机资源的 ...
- Android招聘市场技术要求越来越高,从事三年开发是否应该考虑转行?
这是在某论坛看到的一个网友的疑问,他说感觉现在Android 开发这条路越来越难走了.下面是他的分享: 本来已经做好了好几个月找不到工作的准备.不过这两周感觉面试机会还算可以.两周10个面试感觉刚刚好 ...
- LiteFlow 2.6.0版本发行注记,项目逻辑解耦的利器
前言 自从LiteFlow 2.5.X版本发布依赖,陆续经历了10个小版本的迭代.社区群也稳固增长,每天都有很多小伙伴在问我问题. 但是我发现最多人问我的还是:什么时候能支持界面编排? 从LiteFL ...
- 区块链-NFT 的实现原理
作者:林冠宏 / 指尖下的幽灵.转载者,请: 务必标明出处. 博客:http://www.cnblogs.com/linguanh/ 掘金:https://juejin.im/user/1785262 ...
- noip模拟44[我想我以后会碰见计数题就溜走的]
noip模拟44 solutions 这一场抱零的也忒多了,我也只有45pts 据说好像是把几套题里面最难的收拾出来让我们考得 好惨烈啊,这次的考试我只有第一题骗了40pts,其他都抱零了 T1 Em ...
- SpringBoot快速入门(二)
2.SpringBoot原理分析 2.1.SpringBoot自动配置 Condition Condition 是在Spring 4.0 增加的条件判断功能,通过这个可以功能可以实现选择性的创建 Be ...
- Windows安装Svn客户端
一.下载程序 官网地址,选择最新64位下载. 下载完成 二.安装过程 点击下一步 点击下一步 选择安装目录 点击安装 安装完成 三.修改中文 下载中文包 下载完成 点击下一步 安装完成 点击设置 选择 ...
- vim宏录制
宏录制 当你要重复某一个操作时,录制的宏可以很快地帮你完成任务. 准备文本 <!DOCTYPE html> <html lang="en"> <hea ...