检查系统与内核版本
dae 对内核版本有要求,最低需要 5.17,建议使用 6.1 及以上版本。先查看当前 Debian 版本和内核版本。
lvbu@debian:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 13 (trixie)
Release: 13
Codename: trixie
lvbu@debian:~$ uname -r
6.12.117+deb13-amd64从结果可以看到,当前系统为 Debian 13,内核版本为 6.12.117+deb13-amd64,满足 dae 的运行要求。
开启 IP 转发
旁路由模式需要开启 IPv4 和 IPv6 转发,否则局域网内其他设备的流量无法正常经过这台旁路由转发。
将转发参数写入 /etc/sysctl.conf:
lvbu@debian:~$ echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf
net.ipv4.ip_forward=1
lvbu@debian:~$ echo "net.ipv6.conf.all.forwarding=1" | sudo tee -a /etc/sysctl.conf
net.ipv6.conf.all.forwarding=1然后使配置立即生效:
lvbu@debian:~$ sudo sysctl -p
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1看到以上输出,说明 IPv4 和 IPv6 转发均已开启。
三、安装dae
Debian/Ubuntu 系可以通过 apt 源安装 dae。根据 APT 版本选择对应的源配置方式。
使用APT安装
APT ≥ 3.0 时:
# APT ≥3.0
sudo curl -fsSL -o /etc/apt/sources.list.d/daeuniverse.sources https://daeuniverse.pages.dev/daeuniverse.sourcesAPT <3.0 时:
# APT <3.0
sudo curl -fsSL -o /etc/apt/sources.list.d/daeuniverse.list https://daeuniverse.pages.dev/daeuniverse.list
sudo curl -fsSL -o /usr/share/keyrings/daeuniverse-archive-goose.gpg https://daeuniverse.pages.dev/daeuniverse-archive-goose.gpg更新软件源并安装:
sudo apt update
sudo apt install dae或者通过官方 release 安装
也可以到官方 release 页面下载对应的 deb 包进行安装:
lvbu@debian:~$ wget https://v4.gh-proxy.org/https://github.com/daeuniverse/dae/releases/download/v2.1.2/dae-linux-x86_64.deb
lvbu@debian:~$ sudo apt install ./dae-linux-x86_64.deb安装完成后,可以继续进行配置文件创建。
创建配置文件
先创建配置目录:
lvbu@debian:~$ sudo mkdir -p /etc/dae然后写入 /etc/dae/config.dae。下面的配置包含全局设置、节点配置、节点分组、DNS 分流和路由规则。
lvbu@debian:~$ sudo tee /etc/dae/config.dae > /dev/null << 'EOF'
global {
# 旁路由局域网网卡
lan_interface: eth0
wan_interface: auto
log_level: info
auto_config_kernel_parameter: true
dial_mode: domain
allow_insecure: false
}
# 节点配置
node {
# hysteria2 URI根据具体填写,去掉hy2前备注启用
#hy2: 'hysteria2://[auth@]hostname[:port]/?[key=value]&[key=value]...[#name]'
}
# 节点分组
group {
proxy {
filter: name(hy2)
policy: fixed(0)
}
}
# DNS分流
dns {
upstream {
alidns: 'udp://223.5.5.5:53'
googledns: 'tcp+udp://8.8.8.8:53'
}
routing {
request {
# 国内域名走阿里DNS
qname(geosite:cn) -> alidns
# 其他走 Google DNS
fallback: googledns
}
}
}
# 路由规则
routing {
# 本机关键进程强制直连
pname(NetworkManager, systemd-resolved, dnsmasq) -> must_direct
# 节点小宝强制直连
pname(owjdxb, NodeBabyLinkServ) -> must_direct
dip(10.222.222.0/24) -> must_direct
# Tailscale
pname(tailscaled) -> must_direct
dip(100.64.0.0/10) -> must_direct
# 广告拦截
domain(geosite:category-ads-all) -> block
domain(geosite:category-ads) -> block
# 内网、广播地址直连
dip(geoip:private) -> direct
dip(224.0.0.0/3, 'ff00::/8') -> direct
# 国内IP和域名直连
dip(geoip:cn) -> direct
domain(geosite:cn) -> direct
# 其余流量走代理
fallback: proxy
}
EOF配置时需要注意:
lan_interface需要填写旁路由的局域网网卡名称。本文示例为eth0,如果实际网卡名不是eth0,可以用ip addr查看并替换。node中的 hysteria2 URI 需要根据自己的节点信息填写,并去掉前面的注释符号。group中通过filter: name(hy2)匹配节点名称。- DNS 分流中,国内域名走阿里 DNS,其他域名走 Google DNS。
- 路由规则中,对本机关键进程、节点小宝、Tailscale、内网地址、国内 IP/域名等做了直连或分流处理,广告域名进行拦截,其余流量走代理。
改配置文件权限
配置文件可能包含节点信息,建议限制访问权限,仅允许 root 读写。
lvbu@debian:~$ sudo chmod 600 /etc/dae/config.dae
lvbu@debian:~$ sudo chown root:root /etc/dae/config.dae这样配置文件的权限为 600,所有者为 root:root,可以避免普通用户读取敏感配置。
验证配置
修改完成后,使用 dae 自带的校验命令检查配置文件是否正确:
lvbu@debian:~$ sudo dae validate -c /etc/dae/config.dae如果命令没有输出结果,一般说明配置正常。如果出现报错,可以根据提示检查配置语法、节点 URI、网卡名称等内容。
七、重启服务
配置校验通过后,重启 dae 服务:
lvbu@debian:~$ sudo systemctl restart dae查看服务运行状态:
lvbu@debian:~$ systemctl status dae在 systemctl status dae 的输出中,确认服务处于 active (running) 状态,并且没有明显的错误日志。
验证分流
可以通过 DNS 查询和访问测试来观察效果。
lvbu@debian:~$ dig baidu.com +short
111.63.65.103
110.242.74.102
111.63.65.247
124.237.177.164lvbu@debian:~$ dig youtube.com +short
142.251.179.91
142.251.179.136
142.251.179.93
142.251.179.190再测试广告域名的访问情况:
lvbu@debian:~$ curl -I --max-time 3 https://pagead2.googlesyndication.com
curl: (28) Connection timed out after 3001 milliseconds这里 pagead2.googlesyndication.com 连接超时,符合配置中广告拦截规则的预期效果。