ubuntu core修改dns

简介

早上把nanppi r2s换成了ubuntu core 改了静态ip发现dns不能生效

操作

看了下/etc/resolv.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# 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 127.0.0.53
options edns0

This file is managed by man:systemd-resolved(8)

那就知道了,找了一下,配置文件在这里/etc/systemd/resolved.conf

修改dns

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#  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=114.114.114.114
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes

重启systemd-resolved服务

systemctl restart systemd-resolved.service

ping 下百度发现可以解析了

看下systemd-resolved状态

systemd-resolve --status

显示

1
2
3
4
5
6
Global
DNS Servers: 114.114.114.114
DNSSEC NTA: 10.in-addr.arpa
16.172.in-addr.arpa
168.192.in-addr.arpa
17.172.in-addr.arpa

修改成功

欢迎关注Bboysoul的博客www.bboy.app
Have Fun

欢迎关注我的其它发布渠道