Advertisement
ujiajah1

untuk rc.local ubuntu router proxy

Feb 8th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.58 KB | None | 0 0
  1. # ip table
  2. # dulu disaat kita mamam bersama
  3. # dulu kapan yah
  4. # yah dulu jaman dahulu kala
  5. iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j DNAT –to-destination 192.9.200.32:3128
  6. iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 443 -j DNAT –to-destination 192.9.200.32:3129
  7.  
  8.  
  9. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  10. iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -j MASQUERADE
  11. iptables -I INPUT -p tcp -m tcp --dport 3129 -j ACCEPT
  12. modprobe xt_TPROXY
  13. modprobe xt_socket
  14. modprobe xt_mark
  15. modprobe nf_nat
  16. modprobe nf_conntrack_ipv4
  17. modprobe nf_conntrack
  18. modprobe nf_defrag_ipv4
  19. modprobe ipt_REDIRECT
  20. modprobe iptable_nat
  21. echo 1 > /proc/sys/net/ipv4/ip_forward
  22. echo 0 > /proc/sys/net/ipv4/conf/default/rp_filter
  23. echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
  24. echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter
  25. ip rule add fwmark 1 lookup 100
  26. ip route add local 0.0.0.0/0 dev lo table 100
  27. iptables -t mangle -F
  28. iptables -t mangle -X
  29. iptables -t mangle -N DIVERT
  30. iptables -t mangle -A DIVERT -j MARK --set-mark 1
  31. iptables -t mangle -A DIVERT -j ACCEPT
  32. iptables -t mangle -A INPUT -j ACCEPT
  33. iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT
  34. iptables -t mangle -A PREROUTING -d 192.168.137.2 -p tcp -m multiport --dports 22,80,443,3127,3128,3129,8000,8080,10000 -j ACCEPT
  35. iptables -t mangle -A PREROUTING ! -d 192.168.137.2 -p tcp -m multiport --dports 80,8080,8000 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3129
  36. iptables -t mangle -A PREROUTING ! -d 192.168.137.2 -p tcp -m multiport --dports 443 -j TPROXY --tproxy-mark 0x1/0x1 --on-port 3127
  37. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement