# Ubuntu 18.04 手动修改 DNS 方法

使用root权限

```
nano /etc/systemd/resolved.conf
```

这个文件的默认配置如下：

```
[Resolve]
#DNS=
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes
```

将 DNS 前面的 `#` 去掉并填入新的 DNS 地址，本文以修改成谷歌 DNS 为例，修改后如下：

```
[Resolve]
DNS=1.1.1.1 1.0.0.1
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes
```

修改完成后保存重启 `system resolve` 服务生效：

```
systemctl restart systemd-resolved.service
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.ukenn.top/seedbox-wiki-1/ubuntu-18.04-shou-dong-xiu-gai-dns-fang-fa.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
