add missing copyright notices
[openwrt-10.03/.git] / package / iptables / files / firewall.user
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 . /etc/config/network
5
6 WAN="$wan_ifname"
7 LAN="$lan_ifname"
8
9 iptables -F input_rule
10 iptables -F output_rule
11 iptables -F forwarding_rule
12 iptables -t nat -F prerouting_rule
13 iptables -t nat -F postrouting_rule
14
15 ### BIG FAT DISCLAIMER
16 ## The "-i $WAN" is used to match packets that come in via the $WAN interface.
17 ## it WILL NOT MATCH packets sent from the $WAN ip address -- you won't be able
18 ## to see the effects from within the LAN.
19
20 ### Open port to WAN
21 ## -- This allows port 22 to be answered by (dropbear on) the router
22 # iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 22 -j ACCEPT 
23 # iptables        -A input_rule      -i $WAN -p tcp --dport 22 -j ACCEPT
24
25 ### Port forwarding
26 ## -- This forwards port 8080 on the WAN to port 80 on 192.168.1.2
27 # iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 8080 -j DNAT --to 192.168.1.2:80
28 # iptables        -A forwarding_rule -i $WAN -p tcp --dport 80 -d 192.168.1.2 -j ACCEPT
29
30 ### DMZ
31 ## -- Connections to ports not handled above will be forwarded to 192.168.1.2
32 # iptables -t nat -A prerouting_rule -i $WAN -j DNAT --to 192.168.1.2
33 # iptables        -A forwarding_rule -i $WAN -d 192.168.1.2 -j ACCEPT