2023-03-25 16:57:02 +07:00
|
|
|
|
# 吃鹅直通手册
|
|
|
|
|
|
|
|
|
|
## Linux 内核要求
|
|
|
|
|
|
2023-05-20 23:41:44 +07:00
|
|
|
|
### 内核版本
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
|
|
|
|
使用 `uname -r` 来查看内核版本。
|
|
|
|
|
|
|
|
|
|
> **注意**
|
2023-07-09 16:31:47 +07:00
|
|
|
|
> 如果你的内核版本低于 `5.8`,可以参考 [**Upgrade Guide**](../en/user-guide/kernel-upgrade.md) 升级你的内核。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
2023-05-20 23:41:44 +07:00
|
|
|
|
`绑定到 LAN 接口: >= 5.8`
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
2023-03-25 17:14:10 +07:00
|
|
|
|
如果你想作为路由器、网桥等中间设备,为其他设备提供代理服务,需要把 dae 绑定到 LAN 接口上。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
2023-03-25 17:14:10 +07:00
|
|
|
|
该特性要求 dae 所在的设备的内核版本 >= 5.8。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
2023-03-25 17:14:10 +07:00
|
|
|
|
如果你只在 `lan_interface` 中填写了接口,而未在 `wan_interface` 中填写内容,那么本地程序将无法被代理。如果你期望代理本地程序,需要在 `wan_interface` 中填写 `auto` 或是手动输入 WAN 接口。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
2024-04-08 21:23:55 +07:00
|
|
|
|
`绑定到 WAN 接口: >= 5.15`
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
|
|
|
|
如果你想为本地程序提供代理服务,需要把 dae 绑定到 WAN 接口上。
|
|
|
|
|
|
2024-04-08 21:23:55 +07:00
|
|
|
|
该特性要求 dae 所在的设备的内核版本 >= 5.15。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
2023-03-25 17:14:10 +07:00
|
|
|
|
如果你只在 `wan_interface` 中填写了接口或 `auto`,而未在 `lan_interface` 中填写内容,那么从局域网中传来的流量将无法被代理。如果你想同时代理本机和局域网流量,请同时填写 `wan_interface` 和 `lan_interface`。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
2024-03-30 13:34:15 +07:00
|
|
|
|
`使用 trace 命令`
|
|
|
|
|
|
|
|
|
|
如果你想用 `dae trace` 命令来诊断网络连通性问题,所在的设备内核版本要求 >= 5.15 。
|
|
|
|
|
|
2023-03-25 16:57:02 +07:00
|
|
|
|
## 内核配置选项
|
|
|
|
|
|
2023-03-25 17:14:10 +07:00
|
|
|
|
通常,主流桌面发行版都会打开这些选项。但是为了减小内核大小,在嵌入式设备发行版(如 OpenWRT、Armbian 等)上这些选项可能处于关闭状态。使用以下命令在你的设备上显示内核配置选项:
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
zcat /proc/config.gz || cat /boot/{config,config-$(uname -r)}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
dae 需要以下内核选项:
|
2023-05-20 23:41:44 +07:00
|
|
|
|
|
2023-03-25 16:57:02 +07:00
|
|
|
|
```
|
2023-03-31 22:44:15 +07:00
|
|
|
|
CONFIG_BPF=y
|
|
|
|
|
CONFIG_BPF_SYSCALL=y
|
|
|
|
|
CONFIG_BPF_JIT=y
|
|
|
|
|
CONFIG_CGROUPS=y
|
|
|
|
|
CONFIG_KPROBES=y
|
2023-03-25 16:57:02 +07:00
|
|
|
|
CONFIG_NET_INGRESS=y
|
|
|
|
|
CONFIG_NET_EGRESS=y
|
2023-03-31 22:44:15 +07:00
|
|
|
|
CONFIG_NET_SCH_INGRESS=m
|
|
|
|
|
CONFIG_NET_CLS_BPF=m
|
|
|
|
|
CONFIG_NET_CLS_ACT=y
|
|
|
|
|
CONFIG_BPF_STREAM_PARSER=y
|
|
|
|
|
CONFIG_DEBUG_INFO=y
|
|
|
|
|
# CONFIG_DEBUG_INFO_REDUCED is not set
|
|
|
|
|
CONFIG_DEBUG_INFO_BTF=y
|
|
|
|
|
CONFIG_KPROBE_EVENTS=y
|
|
|
|
|
CONFIG_BPF_EVENTS=y
|
2023-03-25 16:57:02 +07:00
|
|
|
|
```
|
2023-05-20 23:41:44 +07:00
|
|
|
|
|
2023-03-25 16:57:02 +07:00
|
|
|
|
你可以通过以下命令检查他们:
|
|
|
|
|
|
|
|
|
|
```shell
|
2023-03-31 22:44:15 +07:00
|
|
|
|
(zcat /proc/config.gz || cat /boot/{config,config-$(uname -r)}) | grep -E 'CONFIG_(DEBUG_INFO|DEBUG_INFO_BTF|KPROBES|KPROBE_EVENTS|BPF|BPF_SYSCALL|BPF_JIT|BPF_STREAM_PARSER|NET_CLS_ACT|NET_SCH_INGRESS|NET_INGRESS|NET_EGRESS|NET_CLS_BPF|BPF_EVENTS|CGROUPS)=|# CONFIG_DEBUG_INFO_REDUCED is not set'
|
2023-03-25 16:57:02 +07:00
|
|
|
|
```
|
|
|
|
|
|
2023-07-09 16:31:47 +07:00
|
|
|
|
> **注意**: `Armbian` 用户可以参考 [**Upgrade Guide**](../en/user-guide/kernel-upgrade.md) 升级到支持的内核。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
|
|
|
|
## 安装
|
|
|
|
|
|
2023-09-18 18:55:02 +07:00
|
|
|
|
### Arch Linux / Manjaro
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
2023-09-18 18:55:02 +07:00
|
|
|
|
dae 已发布于 [AUR](https://aur.archlinux.org/packages/dae) 和 [archlinuxcn](https://github.com/archlinuxcn/repo/tree/master/archlinuxcn/dae),使用下述命令安装:
|
|
|
|
|
|
2024-06-16 13:48:23 +07:00
|
|
|
|
#### AUR
|
|
|
|
|
|
|
|
|
|
##### 最新稳定版
|
2023-09-18 18:55:02 +07:00
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
[yay/paru] -S dae
|
|
|
|
|
```
|
|
|
|
|
|
2024-06-16 13:48:23 +07:00
|
|
|
|
##### 最新 Git 版
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
[yay/paru] -S dae-git
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### archlinuxcn
|
|
|
|
|
|
|
|
|
|
##### 最新稳定版 (针对 x86-64 v3 优化)
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
sudo pacman -S dae-bin-x64-v3
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
##### 最新稳定版 (x86-64 或 aarch64 通用版)
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
sudo pacman -S dae
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
##### 最新 Git 版
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
|
|
|
|
```shell
|
2024-06-16 13:48:23 +07:00
|
|
|
|
sudo pacman -S dae-git
|
2023-03-25 16:57:02 +07:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
安装后,使用 systemctl 对服务进行控制:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
# 启动 dae
|
|
|
|
|
sudo systemctl start dae
|
|
|
|
|
|
|
|
|
|
# 开机自动启动 dae
|
|
|
|
|
sudo systemctl enable dae
|
|
|
|
|
```
|
|
|
|
|
|
2023-06-04 11:32:13 +07:00
|
|
|
|
### Gentoo Linux
|
|
|
|
|
|
|
|
|
|
dae 已发布于 [gentoo-zh](https://github.com/microcai/gentoo-zh),可以使用 `app-eselect/eselect-repository` 启用此 overlay:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
eselect repository enable gentoo-zh
|
|
|
|
|
emaint sync -r gentoo-zh
|
|
|
|
|
emerge -a net-proxy/dae
|
|
|
|
|
```
|
|
|
|
|
|
2023-07-26 01:10:47 +07:00
|
|
|
|
### Alpine
|
|
|
|
|
|
|
|
|
|
详见 [run on alpine](../en/tutorials/run-on-alpine.md)。
|
|
|
|
|
|
2023-04-16 16:03:57 +07:00
|
|
|
|
### macOS
|
|
|
|
|
|
2023-07-09 16:31:47 +07:00
|
|
|
|
我们提供了一种比较 hacky 的方式在 macOS 上运行 dae,见 [run on macOS](../en/tutorials/run-on-macos.md)。
|
2023-04-16 16:03:57 +07:00
|
|
|
|
|
2023-03-25 16:57:02 +07:00
|
|
|
|
### Docker
|
|
|
|
|
|
2023-04-10 00:08:58 +07:00
|
|
|
|
预编译镜像可相关文档请查阅:<https://hub.docker.com/r/daeuniverse/dae>。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
|
|
|
|
作为替代,你也可以使用 `docker compose`:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
git clone --depth=1 https://github.com/daeuniverse/dae
|
|
|
|
|
docker compose up -d --build
|
|
|
|
|
```
|
|
|
|
|
|
2023-06-24 20:10:49 +07:00
|
|
|
|
### 手动安装
|
|
|
|
|
|
|
|
|
|
> **Note**: 这种方法仅建议高级用户使用。采用这种方法,用户可以灵活地测试各个版本的 dae。请注意,新引入的功能有时可能存在 bug,因此请自行承担风险。
|
|
|
|
|
|
2023-07-09 16:31:47 +07:00
|
|
|
|
dae 可以以守护进程(systemd)的形式运行,见 [run as daemon](../en/user-guide/run-as-daemon.md)。
|
2023-06-24 20:10:49 +07:00
|
|
|
|
|
2023-03-29 18:09:04 +07:00
|
|
|
|
### 安装脚本
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
2023-03-29 18:09:04 +07:00
|
|
|
|
见 [daeuniverse/dae-installer](https://github.com/daeuniverse/dae-installer)(或使用 [镜像站](https://hubmirror.v2raya.org/daeuniverse/dae-installer))。
|
|
|
|
|
|
|
|
|
|
### 手动构建
|
|
|
|
|
|
2023-07-09 16:31:47 +07:00
|
|
|
|
见 [Build Guide](../en/user-guide/build-by-yourself.md)。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
|
|
|
|
## 最小 dae 配置
|
|
|
|
|
|
|
|
|
|
最小可启动的配置:
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
global{}
|
|
|
|
|
routing{}
|
|
|
|
|
```
|
|
|
|
|
|
2023-03-25 17:14:10 +07:00
|
|
|
|
然而,此配置使 dae 处于空载状态。如果你希望 dae 能正常工作,以下是较小配置下的最佳实践:
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
global {
|
|
|
|
|
# 绑定到 LAN 和/或 WAN 接口。将下述接口替换成你自己的接口名。
|
|
|
|
|
#lan_interface: docker0
|
|
|
|
|
wan_interface: auto # 使用 "auto" 自动侦测 WAN 接口。
|
|
|
|
|
|
|
|
|
|
log_level: info
|
|
|
|
|
allow_insecure: false
|
|
|
|
|
auto_config_kernel_parameter: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
subscription {
|
|
|
|
|
# 在下面填入你的订阅链接。
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-09 16:31:47 +07:00
|
|
|
|
# 更多的 DNS 样例见 https://github.com/daeuniverse/dae/blob/main/docs/en/configuration/dns.md
|
2023-03-25 16:57:02 +07:00
|
|
|
|
dns {
|
|
|
|
|
upstream {
|
2023-04-02 10:07:53 +07:00
|
|
|
|
googledns: 'tcp+udp://dns.google.com:53'
|
2023-03-25 16:57:02 +07:00
|
|
|
|
alidns: 'udp://dns.alidns.com:53'
|
|
|
|
|
}
|
|
|
|
|
routing {
|
|
|
|
|
request {
|
|
|
|
|
fallback: alidns
|
|
|
|
|
}
|
|
|
|
|
response {
|
|
|
|
|
upstream(googledns) -> accept
|
2023-10-21 15:04:13 +07:00
|
|
|
|
ip(geoip:private) && !qname(geosite:cn) -> googledns
|
2023-03-25 16:57:02 +07:00
|
|
|
|
fallback: accept
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group {
|
|
|
|
|
proxy {
|
|
|
|
|
#filter: name(keyword: HK, keyword: SG)
|
|
|
|
|
policy: min_moving_avg
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-09 16:31:47 +07:00
|
|
|
|
# 更多的 Routing 样例见 https://github.com/daeuniverse/dae/blob/main/docs/en/configuration/routing.md
|
2023-03-25 16:57:02 +07:00
|
|
|
|
routing {
|
2024-01-11 20:47:05 +07:00
|
|
|
|
pname(NetworkManager) -> direct
|
2023-03-25 16:57:02 +07:00
|
|
|
|
dip(224.0.0.0/3, 'ff00::/8') -> direct
|
|
|
|
|
|
|
|
|
|
### 以下为自定义规则
|
|
|
|
|
|
2023-11-15 13:32:57 +07:00
|
|
|
|
# 禁用 h3,因为它通常消耗很多 CPU 和内存资源
|
|
|
|
|
l4proto(udp) && dport(443) -> block
|
2023-03-25 16:57:02 +07:00
|
|
|
|
dip(geoip:private) -> direct
|
|
|
|
|
dip(geoip:cn) -> direct
|
|
|
|
|
domain(geosite:cn) -> direct
|
|
|
|
|
|
|
|
|
|
fallback: proxy
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2023-03-26 02:14:55 +07:00
|
|
|
|
如果你不在乎极致速度,而是更注重隐私和 DNS 泄露,使用以下配置替换上述的 dns 部分:
|
2023-05-20 23:41:44 +07:00
|
|
|
|
|
2023-03-26 02:14:55 +07:00
|
|
|
|
```shell
|
|
|
|
|
dns {
|
|
|
|
|
upstream {
|
2023-04-02 10:07:53 +07:00
|
|
|
|
googledns: 'tcp+udp://dns.google.com:53'
|
2023-03-26 02:14:55 +07:00
|
|
|
|
alidns: 'udp://dns.alidns.com:53'
|
|
|
|
|
}
|
|
|
|
|
routing {
|
|
|
|
|
request {
|
|
|
|
|
qname(geosite:cn) -> alidns
|
|
|
|
|
fallback: googledns
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2023-03-25 16:57:02 +07:00
|
|
|
|
完整样例:[example.dae](https://github.com/daeuniverse/dae/blob/main/example.dae)。
|
|
|
|
|
|
|
|
|
|
如果你使用 PVE,可以参考 [#37](https://github.com/daeuniverse/dae/discussions/37)。
|
|
|
|
|
|
|
|
|
|
## 热重载和暂停
|
|
|
|
|
|
|
|
|
|
当配置变化时,可以方便使用命令进行配置的热重载,在该过程中不会中断已有连接。当想暂停代理时,可使用命令进行暂停。
|
|
|
|
|
|
2023-07-09 16:31:47 +07:00
|
|
|
|
详见 [Reload and suspend](../en/user-guide/reload-and-suspend.md)。
|
2023-03-25 16:57:02 +07:00
|
|
|
|
|
|
|
|
|
## 错误排查
|
|
|
|
|
|
2023-07-09 16:31:47 +07:00
|
|
|
|
详见 [Troubleshooting](../en/troubleshooting.md)。
|