ipset create routerproxy hash:net

ipset add routerproxy 8.8.8.8/32
ipset add routerproxy 8.8.4.4/32
ipset add routerproxy 1.1.1.1/32
ipset add routerproxy 28.0.0.0/8

#  IPv6 
ipset create routerproxyv6 hash:net family inet6

# 򼯺 IPv6 ַ
ipset add routerproxyv6 fc00::/18

#  IPv4 ϵļ
ipset save routerproxy -f /etc/mosdns/ipset.routerproxy

#  IPv6 ϵļ
ipset save routerproxyv6 -f /etc/mosdns/ipset.routerproxyv6

# ´ IPv4 
ipset restore -f /etc/mosdns/ipset.routerproxy

# ´ IPv6 
ipset restore -f /etc/mosdns/ipset.routerproxyv6


# Զ
iptables -t mangle -N ROUTER_PROXY_IPV4

# Զбݰ
iptables -t mangle -A ROUTER_PROXY_IPV4 -j MARK --set-mark 1

# ƥ singboxset еĿַ
iptables -t mangle -A OUTPUT -p tcp -m set --match-set routerproxy dst -j ROUTER_PROXY_IPV4
iptables -t mangle -A OUTPUT -p udp -m set --match-set routerproxy dst -j ROUTER_PROXY_IPV4


# Զ
ip6tables -t mangle -N ROUTER_PROXY_IPV6

# Զбݰ
ip6tables -t mangle -A ROUTER_PROXY_IPV6 -j MARK --set-mark 1

# ƥ singboxset еĿַ
ip6tables -t mangle -A OUTPUT -p tcp -m set --match-set routerproxyv6 dst -j ROUTER_PROXY_IPV6
ip6tables -t mangle -A OUTPUT -p udp -m set --match-set routerproxyv6 dst -j ROUTER_PROXY_IPV6


