DAE用法

DAE用法#

#安装dae
sudo sh -c "$(wget -qO- https://github.com/daeuniverse/dae-installer/raw/main/installer.sh)" @ install
#或者
sudo sh -c "$(wget -qO- https://cdn.jsdelivr.net/gh/daeuniverse/dae-installer/installer.sh)" @ install use-cdn
# 完整配置参考 https://github.com/daeuniverse/dae/blob/main/example.dae

global {
    log_level: debug
    lan_interface: eth0
    dial_mode: domain++
}

# DNS 配置
dns {
    ipversion_prefer: 4
    upstream {
        alidns: 'udp://223.5.5.5:53'
        cfdns: 'tcp+udp://1.1.1.1:53'
    }
    routing {
        request {
            qname(geosite:cn) -> alidns
            fallback: cfdns
        }
    }
}

# 直接配置 Hysteria2 节点
node {
    hy2: "hysteria2://user:password@domain:443/?insecure=false"
}

# 节点分组
group {
    proxy {
        # 直接引用上面定义的 hy2 节点
        node: hy2
        policy: min_moving_avg
    }
}

# 路由配置
routing {
    # DNS 服务器直连
    dip(8.8.8.8) -> must_direct
    dip(1.1.1.1) -> must_direct
    domain(dns.alidns.com) -> must_direct
    domain(cloudflare-dns.com) -> must_direct

    # 内网/广播地址直连
    dip(224.0.0.0/3, 'ff00::/8') -> direct
    dip(geoip:private) -> direct

    # 中国大陆 IP 和域名直连
    dip(geoip:cn) -> direct
    domain(geosite:cn) -> direct

    # 其余所有流量走代理
    fallback: proxy
}

Linux透明代理

Linux透明代理#

支持透明代理(Transparent proxy support)#

This feature adds Linux 2.2-like transparent proxy support to current kernels.To use it, enable the socket match and the TPROXY target in your kernel config.You will need policy routing too, so be sure to enable that as well.

该功能为当前内核增加了类似于 Linux 2.2 的透明代理支持。要使用此功能,您需要在内核配置中启用 socket 匹配(socket match)和 TPROXY 目标(TPROXY target)。同时,您还需要策略路由(policy routing),因此请务必也启用该功能。

From Linux 4.18 transparent proxy support is also available in nf_tables.

从 Linux 4.18 开始,nf_tables 也支持透明代理功能。

让非本地套接字工作(Making non-local sockets work)#

The idea is that you identify packets with destination address matching a local socket on your box, set the packet mark to a certain value::