clash/OpenWrt

clash/OpenWrt

不建议使用 OpenClash,坑。

注意:dnsmasq 需要关闭 rebind :

/etc/config/dhcp, 以下行配置为:

config dnsmasq
    option rebind_protection '0'

Clash on OpenWrt

fake-ip range: 10.100.0.0/16
lan ip ranges: 192.168.0.0/16, 10.101.0.0/16

/etc/firewall.user

# clash                                                                                                    
iptables -t mangle -N clash                                                                                
iptables -t nat -N clash                                                                                   
iptables -t mangle -A PREROUTING -j clash                                                                  
iptables -t nat -A prerouting_lan_rule -j clash                                                            
iptables -t nat -A OUTPUT -d 10.100.0.0/16 -j clash

clash.sh

#!/bin/sh

iptables -t mangle -F clash
iptables -t nat -F clash

iptables -t mangle -A clash -d 192.168.0.0/16 -j RETURN
iptables -t mangle -A clash -d 10.101.0.0/16 -j RETURN
iptables -t mangle -A clash -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A clash -p udp --dport 53 -j RETURN
iptables -t mangle -A clash -p udp -j TPROXY --on-port 7892

iptables -t nat -A clash -d 192.168.0.0/16 -j RETURN
iptables -t nat -A clash -d 10.101.0.0/16 -j RETURN
iptables -t nat -A clash -d 127.0.0.0/8 -j RETURN
iptables -t nat -A clash -p tcp -j REDIRECT --to-ports 7892

killall clash
sleep 1
nohup clash  -d /root/files/appdata/clash > /dev/null 2>&1 &

Last update: 2021-01-25 09:23:07 UTC