更新配置文件创建方法

This commit is contained in:
CallMeR
2026-08-14 00:55:51 +08:00
parent 14595919e4
commit e37d437f0f
6 changed files with 64 additions and 155 deletions
+9 -24
View File
@@ -94,12 +94,7 @@ systemd-r 357 systemd-resolve 21u IPv4 3296 0t0 TCP 127.0.0.54:domain (
$ sudo mkdir -p /etc/systemd/resolved.conf.d
## 创建 systemd-resolved 配置文件
$ sudo editor /etc/systemd/resolved.conf.d/10-server-dns.conf
```
在配置文件中输入以下内容,并保存。
```bash
$ sudo tee /etc/systemd/resolved.conf.d/10-server-dns.conf >/dev/null <<'EOF'
# This configuration file is customized by fox,
# Optimize system resolve parameters for local DNS server.
@@ -107,10 +102,10 @@ $ sudo editor /etc/systemd/resolved.conf.d/10-server-dns.conf
DNS=127.0.0.1
DNS=::1
DNSStubListener=no
EOF
```
保存该配置文件后,还需调整系统 `resolv.conf` 配置文件,执行以下命令。
配置文件编辑完成后,还需调整系统 `resolv.conf` 配置文件,执行以下命令。
```bash
## 创建 resolv.conf 软链接
@@ -318,13 +313,6 @@ $ sudo mv /etc/smartdns/smartdns.conf /etc/smartdns/smartdns.conf.bak
创建 `SmartDNS` 主配置文件,执行以下命令。
```bash
## 创建 SmartDNS 主配置文件
$ sudo editor /etc/smartdns/smartdns.conf
```
在编辑器对话框中输入以下内容,并保存。
**额外说明:**
- `SmartDNS` 端口监听参数为 `6053@lo` WebUI 端口监听参数为 `5380` ,请根据实际情况进行调整
@@ -332,6 +320,8 @@ $ sudo editor /etc/smartdns/smartdns.conf
- WebUI 默认用户名密码为 `admin/password` ,若需公网访问建议将默认密码修改为强密码
```bash
## 创建 SmartDNS 主配置文件
$ sudo tee /etc/smartdns/smartdns.conf >/dev/null <<'EOF'
# This configuration file is customized by fox,
# Optimize SmartDNS parameters for local DNS server.
#
@@ -394,7 +384,7 @@ server-https https://dns.alidns.com/dns-query
server-h3 h3://dns.alidns.com/dns-query -fallback
server-https https://doh.360.cn/dns-query -fallback
EOF
```
`SmartDNS` 主配置文件配置完成后,执行以下命令修正文件权限
@@ -415,13 +405,6 @@ $ sudo mkdir -p /etc/dnsmasq.d
创建 `Dnsmasq` 主配置文件,执行以下命令。
```bash
## 创建 Dnsmasq 主配置文件
$ sudo editor /etc/dnsmasq.d/10-server-dnsmasq.conf
```
在编辑器对话框中输入以下内容,并保存。
**额外说明:**
- 请根据系统内存使用情况,调整缓存参数 `cache-size`
@@ -433,6 +416,8 @@ $ sudo editor /etc/dnsmasq.d/10-server-dnsmasq.conf
- `Dnsmasq` 有且仅有 `SmartDNS` 作为上游 DNS 服务器
```bash
## 创建 Dnsmasq 主配置文件
$ sudo tee /etc/dnsmasq.d/10-server-dnsmasq.conf >/dev/null <<'EOF'
# This configuration file is customized by fox,
# Optimize dnsmasq parameters for local DNS server.
@@ -479,7 +464,7 @@ server=/test/
server=/fox.internal/172.16.1.1
server=127.0.0.1#6053
EOF
```
## 7.清理系统