以下是本机通过7070端口访问长城的IPTABLES配置,而PPTP(VPN)需要配置“iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE”才能访问外网,而不能把指定流量转发到7070端口。
代码: 全选
iptables -t nat -N SOCKS
iptables -t nat -A SOCKS -d 59.188.236.196 -j RETURN
iptables -t nat -A SOCKS -d 106.186.126.173 -j RETURN
iptables -t nat -A SOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -A SOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A SOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A SOCKS -d 169.254.0.0/16 -j RETURN
iptables -t nat -A SOCKS -d 172.16.0.0/12 -j RETURN
iptables -t nat -A SOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -A SOCKS -d 224.0.0.0/4 -j RETURN
iptables -t nat -A SOCKS -d 240.0.0.0/4 -j RETURN
iptables -t nat -A SOCKS -p tcp -j REDIRECT --to-ports 7070
iptables -t nat -A OUTPUT -p tcp -j SOCKS