Advertisement
Guest User

blah

a guest
Nov 21st, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. /bin/cp -f /etc/iptables.rules /etc/iptables.rules.old
  2. cat > /etc/iptables.rules <<EOF
  3. *filter
  4. :INPUT ACCEPT [0:0]
  5. :FORWARD ACCEPT [0:0]
  6. :OUTPUT ACCEPT [0:0]
  7. :ICMPALL - [0:0]
  8. :ZREJ - [0:0]
  9. -A INPUT -m conntrack --ctstate INVALID -j DROP
  10. -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  11. -A INPUT -i lo -j ACCEPT
  12. -A INPUT -p icmp --icmp-type 255 -j ICMPALL
  13. -A INPUT -p udp --dport 67:68 --sport 67:68 -j ACCEPT
  14. -A INPUT -p tcp --dport 22 -j ACCEPT
  15. -A INPUT -p udp -m multiport --dports 500,4500 -j ACCEPT
  16. -A INPUT -p udp --dport 1701 -m policy --dir in --pol ipsec -j ACCEPT
  17. -A INPUT -p udp --dport 1701 -j DROP
  18. -A INPUT -j ZREJ
  19. -A FORWARD -i eth+ -o ppp+ -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  20. -A FORWARD -i ppp+ -o eth+ -j ACCEPT
  21. -A FORWARD -j ZREJ
  22. -A ICMPALL -p icmp --fragment -j DROP
  23. -A ICMPALL -p icmp --icmp-type 0 -j ACCEPT
  24. -A ICMPALL -p icmp --icmp-type 3 -j ACCEPT
  25. -A ICMPALL -p icmp --icmp-type 4 -j ACCEPT
  26. -A ICMPALL -p icmp --icmp-type 8 -j ACCEPT
  27. -A ICMPALL -p icmp --icmp-type 11 -j ACCEPT
  28. -A ICMPALL -p icmp -j DROP
  29. -A ZREJ -p tcp -j REJECT --reject-with tcp-reset
  30. -A ZREJ -p udp -j REJECT --reject-with icmp-port-unreachable
  31. -A ZREJ -j REJECT --reject-with icmp-proto-unreachable
  32. COMMIT
  33. *nat
  34. :PREROUTING ACCEPT [0:0]
  35. :INPUT ACCEPT [0:0]
  36. :OUTPUT ACCEPT [0:0]
  37. :POSTROUTING ACCEPT [0:0]
  38. -A POSTROUTING -s 192.168.42.0/24 -o eth+ -j SNAT --to-source ${PRIVATE_IP}
  39. COMMIT
  40. EOF
  41.  
  42. cat > /etc/network/if-pre-up.d/iptablesload <<EOF
  43. #!/bin/sh
  44. /sbin/iptables-restore < /etc/iptables.rules
  45. exit 0
  46. EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement