This commit is contained in:
mzz2017
2023-02-26 19:44:25 +08:00
parent 52708d59ca
commit 0cfbd9ab14
5 changed files with 79 additions and 93 deletions

View File

@ -18,68 +18,6 @@ As a successor of [v2rayA](https://github.com/v2rayA/v2rayA), dae abandoned v2ra
1. Support advanced DNS resolution process.
1. Support full-cone NAT for shadowsocks, trojan(-go) and socks5 (no test).
## Prerequisites
### Kernel Version
Use `uname -r` to check the kernel version on your machine.
**Bind to LAN: >= 5.8**
You need bind dae to LAN interface, if you want to provide network service for LAN as an intermediate device.
This feature requires the kernel version of machine on which dae install >= 5.8.
Note that if you bind dae to LAN only, dae only provide network service for traffic from LAN, and not impact local programs.
**Bind to WAN: >= 5.8**
You need bind dae to WAN interface, if you want dae to provide network service for local programs.
This feature requires kernel version of the machine >= 5.8.
Note that if you bind dae to WAN only, dae only provide network service for local programs and not impact traffic coming in from other interfaces.
### Kernel Configuration Item
Usually, mainstream desktop distributions have these items turned on. But in order to reduce kernel size, some items are turned off by default on embedded device distributions like OpenWRT, Armbian, etc.
Use following command to show kernel configuration items on your machine.
```shell
zcat /proc/config.gz || cat /boot/{config,config-$(uname -r)}
```
dae needs:
```
CONFIG_DEBUG_INFO_BTF=y
CONFIG_NET_CLS_ACT=y
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_INGRESS=y
CONFIG_NET_EGRESS=y
```
Check them using command like:
```shell
(zcat /proc/config.gz || cat /boot/{config,config-$(uname -r)}) | grep -E 'CONFIG_(DEBUG_INFO_BTF|NET_CLS_ACT|NET_SCH_INGRESS|NET_INGRESS|NET_EGRESS)='
```
### Kernel Parameters
If you set up dae as a router or other intermediate device, you need to adjust some linux kernel parameters to make everything work fine. By default, the latest Linux distributions have IP Forwarding `disabled`. In the case where we need to up a Linux router/gateway or a VPN server or simply a plain dial-in server, then we need to enable forwarding. Moreover, in order to keep our gateway position and keep correct downstream route table, we should disable `send-redirects`. Do the followings to adjust linux kernel parameters:
```shell
export lan_ifname=docker0
sudo tee /etc/sysctl.d/60-dae-$lan_ifname.conf << EOF
net.ipv4.conf.$lan_ifname.forwarding = 1
net.ipv6.conf.$lan_ifname.forwarding = 1
net.ipv4.conf.$lan_ifname.send_redirects = 0
EOF
sudo sysctl --system
```
Please modify `docker0` to your LAN interface.
## Getting Started
Please refer to [Quick Start Guide](./docs/getting-started/README.md) to start using `dae` right away!

View File

@ -92,7 +92,7 @@ func checkIpforward(ifname string, ipversion consts.IpVersionStr) error {
if bytes.Equal(bytes.TrimSpace(b), []byte("1")) {
return nil
}
return fmt.Errorf("ipforward on %v is off: %v; see https://github.com/v2rayA/dae#kernel-parameters", ifname, path)
return fmt.Errorf("ipforward on %v is off: %v; see docs of dae for help", ifname, path)
}
func CheckIpforward(ifname string) error {
@ -114,7 +114,7 @@ func checkSendRedirects(ifname string, ipversion consts.IpVersionStr) error {
if bytes.Equal(bytes.TrimSpace(b), []byte("0")) {
return nil
}
return fmt.Errorf("send_directs on %v is on: %v; see https://github.com/v2rayA/dae#kernel-parameters", ifname, path)
return fmt.Errorf("send_directs on %v is on: %v; see docs of dae for help", ifname, path)
}
func CheckSendRedirects(ifname string) error {

View File

@ -2,12 +2,71 @@
## Linux Kernel Requirement
### Kernel Version
## Kernel Version
Use `uname -r` to check the kernel version on your machine.
> **Notes**
> If you find your kernel version is `< 5.8`, follow the guide [HERE](./kernel-upgrade.md) to upgrade the kernel to the minimum required version.
> If you find your kernel version is `< 5.8`, follow the [**Upgrade Guide**](./kernel-upgrade.md) to upgrade the kernel to the minimum required version.
**Bind to LAN: >= 5.8**
You need bind dae to LAN interface, if you want to provide network service for LAN as an intermediate device.
This feature requires the kernel version of machine on which dae install >= 5.8.
Note that if you bind dae to LAN only, dae only provide network service for traffic from LAN, and not impact local programs.
**Bind to WAN: >= 5.8**
You need bind dae to WAN interface, if you want dae to provide network service for local programs.
This feature requires kernel version of the machine >= 5.8.
Note that if you bind dae to WAN only, dae only provide network service for local programs and not impact traffic coming in from other interfaces.
## Kernel Configurations
Usually, mainstream desktop distributions have these items turned on. But in order to reduce kernel size, some items are turned off by default on embedded device distributions like OpenWRT, Armbian, etc.
Use following command to show kernel configuration items on your machine.
```shell
zcat /proc/config.gz || cat /boot/{config,config-$(uname -r)}
```
dae needs:
```
CONFIG_DEBUG_INFO_BTF=y
CONFIG_NET_CLS_ACT=y
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_INGRESS=y
CONFIG_NET_EGRESS=y
```
Check them using command like:
```shell
(zcat /proc/config.gz || cat /boot/{config,config-$(uname -r)}) | grep -E 'CONFIG_(DEBUG_INFO_BTF|NET_CLS_ACT|NET_SCH_INGRESS|NET_INGRESS|NET_EGRESS)='
```
> **Notes**
> `Armbian` users can follow the [**Upgrade Guide**](./kernel-upgrade.md) to upgrade the kernel to meet the kernel configuration requirement.
## Kernel Parameters
If you set up dae as a router or other intermediate device and bind it to LAN interfaces, you need to adjust some linux kernel parameters to make everything work fine. By default, the latest Linux distributions have IP Forwarding `disabled`. In the case where we need to up a Linux router/gateway or a VPN server or simply a plain dial-in server, then we need to enable forwarding. Moreover, in order to keep our gateway position and keep correct downstream route table, we should disable `send-redirects`. Do the followings to adjust linux kernel parameters:
```shell
export lan_ifname=docker0
sudo tee /etc/sysctl.d/60-dae-$lan_ifname.conf << EOF
net.ipv4.conf.$lan_ifname.forwarding = 1
net.ipv6.conf.$lan_ifname.forwarding = 1
net.ipv4.conf.$lan_ifname.send_redirects = 0
EOF
sudo sysctl --system
```
Please modify `docker0` to your LAN interface.
## Usage
@ -46,7 +105,6 @@ pushd /usr/local/share/dae/
curl -L -o geoip.dat https://github.com/v2ray/geoip/releases/latest/download/geoip.dat
curl -L -o geosite.dat https://github.com/v2ray/domain-list-community/releases/latest/download/dlc.dat
popd
```
**Run**

View File

@ -20,30 +20,6 @@ Various Linux distributions have different methods to upgrade the Linux kernel.
> **Note**
> Since `dae` is builts with `eBPF`, your host must meet the minimum Kernel version, `>= 5.8` for dae to properly running.
### Upgrade Kernel on Ubuntu
Ubuntu users can upgrade their Linux kernel upgrading the `linux-image-generic` to a desired version by making use of the [mainline](https://github.com/pimlie/ubuntu-mainline-kernel.sh) tool. It will update both `linux-image-generic` and `linux-headers-generic`.
```bash
sudo apt-add-repository -y ppa:cappelikan/ppa
sudo apt update
sudo apt install wget mainline
wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
chmod +x ubuntu-mainline-kernel.sh
sudo install ubuntu-mainline-kernel.sh /usr/local/bin/
# list available kernel patches
ubuntu-mainline-kernel.sh -l
ubuntu-mainline-kernel.sh -i <DESIRED VERSION>
```
Reboot to take effect
```bash
reboot
uname -r
```
### Upgrade Kernel on other Debian-based Linux
Debian-based distributions like armbian can install a specific version of Kernel on their system. You can run the following command-line on your Linux terminal to install any specific version kernel on your Linux system. After the installation is done, reboot your system to get the desired kernel on your Linux system.
@ -52,7 +28,7 @@ Debian-based distributions like armbian can install a specific version of Kernel
# Sync databases.
sudo apt update
# Search available kernel versions.
apt-cache search linux-image
apt-cache search ^linux-image$
# Install specific image.
sudo apt install <specific-linux-image>
```

View File

@ -9,10 +9,24 @@ dae can run as a daemon(systemd) service so that it can run at boot.
## Prerequisites
**Optional Geo Data Files**
For more convenient traffic split, dae relies on the following data sources, [geoip.dat](https://github.com/v2ray/geoip/releases/latest) and [geosite.dat](https://github.com/v2fly/domain-list-community/releases/latest).
```shell
mkdir -p /usr/local/share/dae/
pushd /usr/local/share/dae/
curl -L -o geoip.dat https://github.com/v2ray/geoip/releases/latest/download/geoip.dat
curl -L -o geosite.dat https://github.com/v2ray/domain-list-community/releases/latest/download/dlc.dat
popd
```
**Configuration File**
> **Note**
> The config file is recommended to save under `/etc/dae`
Download the sample config file
Download the sample config file:
```bash
mkdir -p /etc/dae