firewall.user 1.0 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. # Copyright (C) 2006 OpenWrt.org
  3. iptables -F input_rule
  4. iptables -F output_rule
  5. iptables -F forwarding_rule
  6. iptables -t nat -F prerouting_rule
  7. iptables -t nat -F postrouting_rule
  8. # The following chains are for traffic directed at the IP of the
  9. # WAN interface
  10. iptables -F input_wan
  11. iptables -F forwarding_wan
  12. iptables -t nat -F prerouting_wan
  13. ### Open port to WAN
  14. ## -- This allows port 22 to be answered by (dropbear on) the router
  15. # iptables -t nat -A prerouting_wan -p tcp --dport 22 -j ACCEPT
  16. # iptables -A input_wan -p tcp --dport 22 -j ACCEPT
  17. ### Port forwarding
  18. ## -- This forwards port 8080 on the WAN to port 80 on 192.168.1.2
  19. # iptables -t nat -A prerouting_wan -p tcp --dport 8080 -j DNAT --to 192.168.1.2:80
  20. # iptables -A forwarding_wan -p tcp --dport 80 -d 192.168.1.2 -j ACCEPT
  21. ### DMZ
  22. ## -- Connections to ports not handled above will be forwarded to 192.168.1.2
  23. # iptables -t nat -A prerouting_wan -j DNAT --to 192.168.1.2
  24. # iptables -A forwarding_wan -d 192.168.1.2 -j ACCEPT