Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Squid transparent proxy
- PROXY_IPV4="192.168.x.x"
- PROXY_IPV6="xxxx:xxxx:xxxx:xxxx::x"
- CLIENTIFACE=br0
- FWMARK=3
- iptables -t mangle -A PREROUTING -i $CLIENTIFACE -p tcp --dport 80 -s $PROXY_IPV4 -j ACCEPT
- ip6tables -t mangle -A PREROUTING -i $CLIENTIFACE -p tcp --dport 80 -s $PROXY_IPV6 -j ACCEPT
- iptables -t mangle -A PREROUTING -i $CLIENTIFACE -p tcp --dport 80 -j MARK --set-mark $FWMARK
- iptables -t mangle -A PREROUTING -m mark --mark $FWMARK -j ACCEPT
- ip6tables -t mangle -A PREROUTING -i $CLIENTIFACE -p tcp --dport 80 -j MARK --set-mark $FWMARK
- ip6tables -t mangle -A PREROUTING -m mark --mark $FWMARK -j ACCEPT
- iptables -t filter -A FORWARD -i $CLIENTIFACE -o $CLIENTIFACE -p tcp --dport 80 -j ACCEPT
- ip6tables -t filter -A FORWARD -i $CLIENTIFACE -o $CLIENTIFACE -p tcp --dport 80 -j ACCEPT
- ip rule add fwmark $FWMARK table 2
- ip -6 rule add fwmark $FWMARK table 2
- ip route add default via $PROXY_IPV4 table 2
- ip -6 route add default via $PROXY_IPV6 table 2
- # End Squid intercept proxy config
- iptables -F -t mangle
- iptables -X -t mangle
- ip6tables -F -t mangle
- ip6tables -X -t mangle
- iptables -t mangle -N DIVERT
- ip6tables -t mangle -N DIVERT
- iptables -t mangle -A DIVERT -j MARK --set-mark 1
- iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
- iptables -t mangle -A DIVERT -j ACCEPT
- iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
- ip6tables -t mangle -A DIVERT -j MARK --set-mark 1
- ip6tables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
- ip6tables -t mangle -A DIVERT -j ACCEPT
- ip6tables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
- ip -f inet rule add fwmark 1 lookup 100
- ip -f inet route add local default dev eno1 table 100
- ip -f inet6 rule add fwmark 1 lookup 100
- ip -f inet6 route add local default dev eno1 table 100
- http_port 3129 tproxy
- net.ipv4.ip_forward = 1
- net.ipv4.conf.default.rp_filter = 0
- net.ipv4.conf.all.rp_filter = 0
- net.ipv4.conf.lo.rp_filter = 0
- net.ipv4.conf.eno1.rp_filter = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement