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

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.lryc.cn/news/236412.html

相关文章:

  • VSCode使用MinGW中的go并支持CGO
  • tensor张量 ------ python特殊的数据结构
  • openai/chatgpt的api接口,各个模型的最大输入token一览表
  • Spark作业串行与并行提交job
  • HTTP HTTPS 独特的魅力
  • 【nlp】2.5(gpu version)人名分类器实战项目(对比RNN、LSTM、GRU模型)工程管理方式
  • 金蝶云星空对接打通旺店通·旗舰奇门采购退料单查询接口与创建货品档案接口
  • 在线识别二维码工具
  • CICD 持续集成与持续交付——git
  • 光纤的跳线和尾纤
  • SQL SERVER 2008安装教程
  • 好莱坞罢工事件!再次警醒人类重视AI监管,人工智能矛盾一触即发!
  • 深度学习系列54:使用 MMDETECTION 和 LABEL-STUDIO 进行半自动化目标检测标注
  • WSL2环境下Debian 12的Docker安装与配置
  • 11 月 11 日 ROS 学习笔记——ROS 架构及概念
  • BSN专网项目介绍:宁波市区块链新型基础设施“甬链”
  • 【数据库表及字段统计SQL】【mysql】【clickhouse】【oracle】
  • 如何分析伦敦金的价格走势预测?
  • 【设计原则篇】聊聊接口隔离原则
  • 自压缩llm 为 超长记忆之随机编码(非进制编码)
  • 苹果怎么互传照片?简单方法总结好了!
  • 【ARM Trace32(劳特巴赫) 使用介绍 2.1 -- TRACE32 Practice 脚本 cmm 脚本学习】
  • 学习指南:如何快速上手媒体生态一致体验开发
  • 037、目标检测-算法速览
  • 【开发流程】持续集成、持续交付、持续部署
  • Linux——编译器gcc/g++、调试器gdb以及自动化构建工具makefilemake详解
  • Android registerForActivityResults使用详解以及实现原理
  • 模拟实现一个Linux中的简单版shell
  • 扩散模型实战(十):Stable Diffusion文本条件生成图像大模型
  • LaTex编写伪代码,并实现根据所在章编号(连字符),例如算法1-1