最近在某台服务器上配置了基于域名和nftables的策略路由,记录一下配置过程。
用到的工具是 phantun, wireguard, nftables, chinadns-ng
这是
的姊妹篇,随着工具和技术的迭代,这是目前最新的一篇。
chinadns-ng
首先配置dns 解析服务器,可直接修改 /etc/resolv.conf 添加 nameserver 127.0.0.1 并注释掉其它的 nameserver
chinadns-ng 的配置文件:
53
,
gfwlist.txt
chn
inet@fw@gfwip
4096
86400
20
nftables
inet fw {
gfwip {
ip daddr
interval
{ }
}
gfwip_mark {
route hook output priority filter; policy accept;
daddr @gfwip counter mark set 0x15;
}
}
wireguard
[Interface]
...
21
ip rule add fwmark 0x15 table 21
ip rule del fwmark 0x15 table 21