Advertisement
albspirit86

mikrotik squid mangle

Feb 29th, 2016
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #/etc/rc.local
  2. iptables -t mangle -F
  3. iptables -t mangle -X
  4.  
  5. echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter
  6. echo 1 > /proc/sys/net/ipv4/ip_forward
  7.  
  8. ip rule add fwmark 1 lookup 100
  9. ip route add local 0.0.0.0/0 dev lo table 100
  10.  
  11. iptables -t mangle -N DIVERT
  12. iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
  13.  
  14. iptables -t mangle -A DIVERT -j MARK --set-mark 1
  15. iptables -t mangle -A DIVERT -j ACCEPT
  16.  
  17. iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3128
  18. iptables -t mangle -A PREROUTING -p tcp --dport 8080 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
  19. iptables -t mangle -A PREROUTING -p tcp --dport 443 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3127
  20.  
  21. ##############################################
  22. /ip firewall mangle
  23. add action=mark-connection chain=prerouting comment="HTTP + HTTPS TO PROXY" dst-port=80,443 new-connection-mark=to_proxy protocol=tcp src-address=192.168.10.0/24
  24. add chain=prerouting src-mac-address=xx:xx:xx:xx:xx:xx
  25. add action=mark-routing chain=prerouting connection-mark=to_proxy new-routing-mark=tproxy_route passthrough=no
  26. /ip route
  27. add distance=1 gateway=192.168.5.2 routing-mark=tproxy_route
  28.  
  29.  
  30.  
  31. lan= 192.168.10.0/24
  32. ip ubuntu 192.168.5.2
  33. mac ubuntu xx:xx:xx:xx:xx:xx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement