Advertisement
Guest User

Untitled

a guest
Dec 4th, 2012
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #!/bin/bash
  2. echo Cleaning rules
  3. iptables -F
  4. iptables -X
  5. iptables -t nat -F
  6. iptables -t nat -X
  7. iptables -t mangle -F
  8. iptables -t mangle -X
  9. echo Loading modules for NAT and conntrack
  10. modprobe ip_conntrack
  11. #modprobe ip_conntrack_ftp (xp)
  12. echo Setting default filter policy
  13. iptables -P INPUT DROP
  14. iptables -P OUTPUT ACCEPT
  15. echo Configuring loopback access
  16. iptables -A INPUT -i lo -j ACCEPT
  17. iptables -A OUTPUT -o lo -j ACCEPT
  18. iptables -A FORWARD -o lo -j ACCEPT
  19. echo Configuring UDP, DNS, Passive FTP
  20. iptables -A INPUT -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
  21. echo Configuring externally visible ports
  22. # Pending
  23. echo Configuring NAT
  24. #iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
  25. #iptables --append FORWARD --in-interface eth0 -j ACCEPT
  26. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  27. iptables -A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
  28. echo Configuring LAN access
  29. iptables -A INPUT -i eth0 -j ACCEPT
  30. iptables -A OUTPUT -o eth0 -j ACCEPT
  31. iptables -A INPUT -i eth0 -p icmp -m icmp --icmp-type 8 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
  32. echo Configuring Squid transparent proxy
  33. iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
  34. echo Set default behaviour to drop everything else
  35. iptables -A INPUT -j DROP
  36. iptables-save >/etc/iptables.rules
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement