修复 tee 命令兼容性问题,并优化 Dnsmasq 配置

This commit is contained in:
CallMeR
2026-08-14 14:43:08 +08:00
parent fcc5c2b019
commit e6aab0f222
4 changed files with 83 additions and 73 deletions
+36 -22
View File
@@ -290,6 +290,13 @@ $ sudo crontab -e
30 9 * * * /usr/local/bin/smartdns-cnlist 30 9 * * * /usr/local/bin/smartdns-cnlist
``` ```
系统全局定时任务排期状态可使用以下命令进行查看。
```bash
## 查看系统定时任务
$ sudo cronnext -acl
```
### 6.3. SmartDNS 主配置 ### 6.3. SmartDNS 主配置
`SmartDNS` 配置较为复杂,可按需制定各类 DNS 请求规则,建议先查阅官方提供的 [配置指导](https://pymumu.github.io/smartdns/config/basic-config/) 和 [配置选项](https://pymumu.github.io/smartdns/configuration/) 。 `SmartDNS` 配置较为复杂,可按需制定各类 DNS 请求规则,建议先查阅官方提供的 [配置指导](https://pymumu.github.io/smartdns/config/basic-config/) 和 [配置选项](https://pymumu.github.io/smartdns/configuration/) 。
@@ -313,6 +320,13 @@ $ sudo mv /etc/smartdns/smartdns.conf /etc/smartdns/smartdns.conf.bak
创建 `SmartDNS` 主配置文件,执行以下命令。 创建 `SmartDNS` 主配置文件,执行以下命令。
```bash
## 创建 SmartDNS 主配置文件
$ sudo editor /etc/smartdns/smartdns.conf
```
在编辑器对话框中输入以下内容,并保存。
**额外说明:** **额外说明:**
- `SmartDNS` 端口监听参数为 `6053@lo` WebUI 端口监听参数为 `5380` ,请根据实际情况进行调整 - `SmartDNS` 端口监听参数为 `6053@lo` WebUI 端口监听参数为 `5380` ,请根据实际情况进行调整
@@ -320,8 +334,6 @@ $ sudo mv /etc/smartdns/smartdns.conf /etc/smartdns/smartdns.conf.bak
- WebUI 默认用户名密码为 `admin/password` ,若需公网访问建议将默认密码修改为强密码 - WebUI 默认用户名密码为 `admin/password` ,若需公网访问建议将默认密码修改为强密码
```bash ```bash
## 创建 SmartDNS 主配置文件
$ sudo tee /etc/smartdns/smartdns.conf >/dev/null <<'EOF'
# This configuration file is customized by fox, # This configuration file is customized by fox,
# Optimize SmartDNS parameters for local DNS server. # Optimize SmartDNS parameters for local DNS server.
# #
@@ -384,7 +396,7 @@ server-https https://dns.alidns.com/dns-query
server-h3 h3://dns.alidns.com/dns-query -fallback server-h3 h3://dns.alidns.com/dns-query -fallback
server-https https://doh.360.cn/dns-query -fallback server-https https://doh.360.cn/dns-query -fallback
EOF
``` ```
`SmartDNS` 主配置文件配置完成后,执行以下命令修正文件权限 `SmartDNS` 主配置文件配置完成后,执行以下命令修正文件权限
@@ -405,6 +417,13 @@ $ sudo mkdir -p /etc/dnsmasq.d
创建 `Dnsmasq` 主配置文件,执行以下命令。 创建 `Dnsmasq` 主配置文件,执行以下命令。
```bash
## 创建 Dnsmasq 主配置文件
$ sudo editor /etc/dnsmasq.d/10-server-dnsmasq.conf
```
在编辑器对话框中输入以下内容,并保存。
**额外说明:** **额外说明:**
- 请根据系统内存使用情况,调整缓存参数 `cache-size` - 请根据系统内存使用情况,调整缓存参数 `cache-size`
@@ -416,16 +435,11 @@ $ sudo mkdir -p /etc/dnsmasq.d
- `Dnsmasq` 有且仅有 `SmartDNS` 作为上游 DNS 服务器 - `Dnsmasq` 有且仅有 `SmartDNS` 作为上游 DNS 服务器
```bash ```bash
## 创建 Dnsmasq 主配置文件
$ sudo tee /etc/dnsmasq.d/10-server-dnsmasq.conf >/dev/null <<'EOF'
# This configuration file is customized by fox, # This configuration file is customized by fox,
# Optimize dnsmasq parameters for local DNS server. # Optimize dnsmasq parameters for local DNS server.
# Main Config # Main Config
conf-dir=/etc/dnsmasq.d/,*.conf
conf-file=/etc/dnsmasq.conf
log-facility=/var/log/dnsmasq.log log-facility=/var/log/dnsmasq.log
log-async=20 log-async=20
@@ -434,37 +448,37 @@ max-cache-ttl=7200
fast-dns-retry=1800 fast-dns-retry=1800
interface=eth0 interface=eth0
rebind-domain-ok=/fox.internal/
bind-dynamic bind-dynamic
bogus-priv bogus-priv
domain-needed domain-needed
no-hosts no-hosts
no-negcache no-ident
no-resolv no-resolv
no-round-robin no-round-robin
rebind-localhost-ok rebind-localhost-ok
stop-dns-rebind stop-dns-rebind
rebind-domain-ok=/fox.internal/
# DNS Filter # DNS Filter
server=/alt/ local=/alt/
server=/bind/ local=/bind/
server=/example/ local=/example/
server=/home.arpa/ local=/home.arpa/
server=/internal/ local=/internal/
server=/invalid/ local=/invalid/
server=/lan/ local=/lan/
server=/local/ local=/local/
server=/localhost/ local=/localhost/
server=/onion/ local=/onion/
server=/test/ local=/test/
# DNS Server # DNS Server
server=/fox.internal/172.16.1.1 server=/fox.internal/172.16.1.1
server=127.0.0.1#6053 server=127.0.0.1#6053
EOF
``` ```
## 7.清理系统 ## 7.清理系统
+21 -19
View File
@@ -481,6 +481,13 @@ $ sudo mkdir -p /etc/dnsmasq.d
创建 `Dnsmasq` 主配置文件,执行以下命令。 创建 `Dnsmasq` 主配置文件,执行以下命令。
```bash
## 创建 Dnsmasq 主配置文件
$ sudo editor /etc/dnsmasq.d/10-server-dnsmasq.conf
```
在编辑器对话框中输入以下内容,并保存。
**额外说明:** **额外说明:**
- 请根据系统内存使用情况,调整缓存参数 `cache-size` - 请根据系统内存使用情况,调整缓存参数 `cache-size`
@@ -495,16 +502,11 @@ $ sudo mkdir -p /etc/dnsmasq.d
- `server` 参数中的其他 DNS 服务器供 TS 服务器自身及其下游设备使用 - `server` 参数中的其他 DNS 服务器供 TS 服务器自身及其下游设备使用
```bash ```bash
## 创建 Dnsmasq 主配置文件
$ sudo tee /etc/dnsmasq.d/10-server-dnsmasq.conf >/dev/null <<'EOF'
# This configuration file is customized by fox, # This configuration file is customized by fox,
# Optimize dnsmasq parameters for local TS server. # Optimize dnsmasq parameters for local TS server.
# Main Config # Main Config
conf-dir=/etc/dnsmasq.d/,*.conf
conf-file=/etc/dnsmasq.conf
log-facility=/var/log/dnsmasq.log log-facility=/var/log/dnsmasq.log
log-async=20 log-async=20
@@ -513,38 +515,38 @@ max-cache-ttl=7200
fast-dns-retry=1800 fast-dns-retry=1800
interface=eth0,tailscale0 interface=eth0,tailscale0
rebind-domain-ok=/fox.internal/
bind-dynamic bind-dynamic
bogus-priv bogus-priv
domain-needed domain-needed
no-hosts no-hosts
no-negcache no-ident
no-resolv no-resolv
no-round-robin no-round-robin
rebind-localhost-ok rebind-localhost-ok
stop-dns-rebind stop-dns-rebind
rebind-domain-ok=/fox.internal/
# DNS Filter # DNS Filter
server=/alt/ local=/alt/
server=/bind/ local=/bind/
server=/example/ local=/example/
server=/home.arpa/ local=/home.arpa/
server=/internal/ local=/internal/
server=/invalid/ local=/invalid/
server=/lan/ local=/lan/
server=/local/ local=/local/
server=/localhost/ local=/localhost/
server=/onion/ local=/onion/
server=/test/ local=/test/
# DNS Server # DNS Server
server=/ts.net/100.100.100.100 server=/ts.net/100.100.100.100
server=/fox.internal/172.16.1.1 server=/fox.internal/172.16.1.1
server=172.16.1.1 server=172.16.1.1
EOF
``` ```
配置完成后,需重启 `dnsmasq.service` 服务。 配置完成后,需重启 `dnsmasq.service` 服务。
+13 -16
View File
@@ -3,9 +3,6 @@
# Main Config # Main Config
conf-dir=/etc/dnsmasq.d/,*.conf
conf-file=/etc/dnsmasq.conf
log-facility=/var/log/dnsmasq.log log-facility=/var/log/dnsmasq.log
log-async=20 log-async=20
@@ -14,31 +11,31 @@ max-cache-ttl=7200
fast-dns-retry=1800 fast-dns-retry=1800
interface=eth0 interface=eth0
rebind-domain-ok=/fox.internal/
bind-dynamic bind-dynamic
bogus-priv bogus-priv
domain-needed domain-needed
no-hosts no-hosts
no-negcache no-ident
no-resolv no-resolv
no-round-robin no-round-robin
rebind-localhost-ok rebind-localhost-ok
stop-dns-rebind stop-dns-rebind
rebind-domain-ok=/fox.internal/
# DNS Filter # DNS Filter
server=/alt/ local=/alt/
server=/bind/ local=/bind/
server=/example/ local=/example/
server=/home.arpa/ local=/home.arpa/
server=/internal/ local=/internal/
server=/invalid/ local=/invalid/
server=/lan/ local=/lan/
server=/local/ local=/local/
server=/localhost/ local=/localhost/
server=/onion/ local=/onion/
server=/test/ local=/test/
# DNS Server # DNS Server
+13 -16
View File
@@ -3,9 +3,6 @@
# Main Config # Main Config
conf-dir=/etc/dnsmasq.d/,*.conf
conf-file=/etc/dnsmasq.conf
log-facility=/var/log/dnsmasq.log log-facility=/var/log/dnsmasq.log
log-async=20 log-async=20
@@ -14,31 +11,31 @@ max-cache-ttl=7200
fast-dns-retry=1800 fast-dns-retry=1800
interface=eth0,tailscale0 interface=eth0,tailscale0
rebind-domain-ok=/fox.internal/
bind-dynamic bind-dynamic
bogus-priv bogus-priv
domain-needed domain-needed
no-hosts no-hosts
no-negcache no-ident
no-resolv no-resolv
no-round-robin no-round-robin
rebind-localhost-ok rebind-localhost-ok
stop-dns-rebind stop-dns-rebind
rebind-domain-ok=/fox.internal/
# DNS Filter # DNS Filter
server=/alt/ local=/alt/
server=/bind/ local=/bind/
server=/example/ local=/example/
server=/home.arpa/ local=/home.arpa/
server=/internal/ local=/internal/
server=/invalid/ local=/invalid/
server=/lan/ local=/lan/
server=/local/ local=/local/
server=/localhost/ local=/localhost/
server=/onion/ local=/onion/
server=/test/ local=/test/
# DNS Server # DNS Server