Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2011
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # iptables example configuration script
  4. #
  5. # Flush all current rules from iptables
  6. #
  7. iptables -F
  8.  
  9. #
  10. # Set default policies for INPUT, FORWARD and OUTPUT chains
  11. #
  12. iptables -P INPUT ACCEPT
  13. iptables -P FORWARD ACCEPT
  14. iptables -P OUTPUT ACCEPT
  15.  
  16. #
  17. # Allow SSH connections on tcp port 22
  18. #
  19. iptables -A INPUT -i eto0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
  20. iptables -A OUTPUT -o eto0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT
  21.  
  22. #
  23. # Set access for localhost
  24. #
  25. iptables -A INPUT -i lo -j ACCEPT
  26.  
  27. #
  28. # Accept connections on 1194 for vpn access from client
  29. #
  30. iptables -A INPUT -i eth0 -p udp --dport 1194 -m state --state NEW,ESTABLISHED -j ACCEPT
  31. iptables -A OUTPUT -o eth0 -p udp --sport 1194 -m state --state ESTABLISHED -j ACCEPT
  32.  
  33. #
  34. # Apply forwarding for OpenVPN Tunneling
  35. #
  36. iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
  37. iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
  38. iptables -t nat -A POSTROUTING -s 10.8.0.0./24 -o eth0 -j MASQUERADE
  39. iptables -A FORWARD -j REJECT
  40.  
  41. #
  42. # Enable forwarding
  43. #
  44. echo 1 > /proc/sys/net/ipv4/ip_forward
  45.  
  46. #
  47. # List rules
  48. #
  49. iptables -L -v
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement