• 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 文件的软链接。

  • 相关阅读:
    手把手教大家搭建微信公众号查题
    CAS部署使用以及登录成功跳转地址
    记录vector中resize()函数的功能
    [字符串和内存函数]strcat字符串函数的详解和模拟
    Redis在分布式场景下的应用
    欧姆龙plc梯形图T_T
    【毕业设计源码】基于小程序蔬菜/零食商城系统
    坦桑尼亚COC认证是什么?什么是坦桑尼亚COC认证?
    springboot项目打包成jar
    AOSP ~ GDB 远程调试
  • 原文地址:https://blog.csdn.net/liulilittle/article/details/134494212