以下是配置: 1. wg0: #!/bin/sh if [ $ACTION = "ifup" -a $INTERFACE = "wg0" ] then
ip route add 8.8.8.8 dev wg0 ipset list gfwlist || ipset create gfwlist hash:ip ## Needed for dhcp client who gets IP dynamically: /etc/init.d/dnsmasq restart
for ip in $(cat '/etc/customed_proxy_ip.txt'); do ipset add gfwlist $ip done
cat /etc/iproute2/rt_tables | grep gfwtable if [ $? -eq 0 ];then echo "gfwtable has already exsisted!" else echo "200 gfwtable" >> /etc/iproute2/rt_tables fi
iptables -t mangle -N fwmark iptables -t mangle -C OUTPUT -j fwmark || iptables -t mangle -A OUTPUT -j fwmark iptables -t mangle -C PREROUTING -j fwmark || iptables -t mangle -A PREROUTING -j fwmark iptables -t mangle -C fwmark -m set --match-set gfwlist dst -j MARK --set-mark 0xffff || iptables -t mangle -A fwmark -m set --match-set gfwlist dst -j MARK --set-mark 0xffff