当前位置: 首页 > article >正文

Ubuntu 18.04/20.04 LTS 操作系统设置静态DNS

1、nano /etc/systemd/resolved.conf

2、修改配置

使用DNS服务器:223.5.5.5 223.6.6.6 

[Resolve]
DNS=223.5.5.5 223.6.6.6

3、重启服务

systemctl restart systemd-resolved.service

4、查看解析文件

cat /run/systemd/resolve/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 uplink DNS servers. This file lists all configured search domains.
#
# 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
nameserver 183.221.253.100
# Too many DNS servers configured, the following entries may be ignored.
nameserver 61.139.2.69
search DHCP HOST
 

5、查看临时解析文件

nano /etc/resolv.conf

  GNU nano 4.8                                                                             /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
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53
search DHCP HOST
 

如果操作系统使用的临时配置的DNS服务器不是127.0.0.53,那就说明你需要把现在的 /etc/resolv.conf 文件删除,然后重新 ln -sf 建立一个 /run/systemd/resolve/resolv.conf 到 /etc/resolv.conf 文件的软链接。


http://www.kler.cn/news/135484.html

相关文章:

  • Hive常见的面试题(十二道)
  • 【JS】Chapter13-构造函数数据常用函数
  • 【python基础】类详解:如何编写类、__init__()、修改实例属性、类存储到模块并导入、py标准库、编写类的约定
  • STM32硬件调试器不一定准确,proteus不一定准确
  • Motion Plan之搜素算法笔记
  • Ubuntu(Linux)的基本操作
  • 什么是Mock?为什么要使用Mock呢?
  • 深度学习乳腺癌分类 计算机竞赛
  • 《微信小程序开发从入门到实战》学习二十二
  • Vue3新增加的css语法糖
  • 牛掰的dd命令,cpi0配合find备份(不会主动备份),od查看
  • 测试Bard和ChatGPT关于双休的法规和推理
  • 【Java 进阶篇】Ajax 实现——JQuery 实现方式 `ajax()`
  • java学习part06数组
  • UDP网络套接字编程
  • 【开源】基于Vue.js的高校宿舍调配管理系统
  • MATLAB读取每行文本并提取字符串后的数字
  • Vim 从何而来?
  • Go并发编程学习-class1
  • 使用 VPN ,一定要知道的几个真相!
  • 5分钟带你了解什么是敏捷测试?难点显而易见!
  • qt使用AES加密、解密字符串
  • vue过渡,vue3组合式API详细介绍
  • Ajax之引入
  • 配置 `PostgreSQL` 与 `Keepalived` 以实现高可用性
  • 开发者生态:共享知识,携手共进,共创技术辉煌
  • PHP项目学习笔记-萤火商城-增加一个模块(表涉及到的操作和文件)
  • vue3项目安装eslint和prettier
  • mysql面试题——存储引擎相关
  • Typora下载安装 (Mac和Windows)图文详解