#0 iptables -A POSTROUTING -t nat -j MASQUERADE -o eth0 #1 iptables -t mangle -F iptables -t mangle -X #2 echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter echo 1 > /proc/sys/net/ipv4/ip_forward #3 ip rule add fwmark 1 lookup 100 ip route add local 0.0.0.0/0 dev lo table 100 #4 iptables -t mangle -N DIVERT iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT #5 iptables -t mangle -A DIVERT -j MARK --set-mark 1 iptables -t mangle -A DIVERT -j ACCEPT #6 iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129 iptables -t mangle -A PREROUTING -p tcp --dport 443 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3130 #7 squid start exit 0