0
0
Fork 0
mirror of https://github.com/semigodking/redsocks.git synced 2026-04-21 06:29:40 +00:00
UDP透明代理配置示例
Hao Hu edited this page 2020-05-04 09:32:47 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

说明

要实现不指定目标IP及端口的UDP透明代理要求系统安装TPROXY内核模块。配合socks5或shadowsocks代理支持Full-cone NAT但效果及效率不明确。

REDSOCKS配置文件

base {
 log_debug = off;
 log_info = on;
 daemon = on;
 redirector= iptables;
}

redudp {
 bind = 192.168.1.1:20000;
 relay = example.com:1500;
 type = shadowsocks;
 login = rc4-md5;
 password = "your_passwd";
 udp_timeout = 20;
}

iptables 及 ip rules

ip rule add fwmark 0x01/0x01 table 100
ip route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -N REDSOCKS2
iptables -t mangle -A REDSOCKS2 -p udp --dport 123 -j TPROXY --on-port 20000 --tproxy-mark 0x01/0x01
iptables -t mangle -A PREROUTING -j REDSOCKS2