cb779792d5953fd6f3746010034f4eec0190c338
3 ## Please make changes in /etc/firewall.user
7 WAN
=$
(nvram get wan_ifname
)
8 LAN
=$
(nvram get lan_ifname
)
11 for T
in filter nat mangle
; do
16 iptables
-N input_rule
17 iptables
-N output_rule
18 iptables
-N forwarding_rule
20 iptables
-t nat
-N prerouting_rule
21 iptables
-t nat
-N postrouting_rule
24 ### (connections with the router as destination)
27 iptables
-P INPUT DROP
28 iptables
-A INPUT
-m state
--state INVALID
-j DROP
29 iptables
-A INPUT
-m state
--state RELATED
,ESTABLISHED
-j ACCEPT
30 iptables
-A INPUT
-p tcp
--tcp-flags SYN SYN
--tcp-option \
! 2 -j DROP
33 # insert accept rule or to jump to new accept-check table here
35 iptables
-A INPUT
-j input_rule
38 iptables
-A INPUT
-i \
! $WAN -j ACCEPT
# allow from lan/wifi interfaces
39 iptables
-A INPUT
-p icmp
-j ACCEPT
# allow ICMP
40 iptables
-A INPUT
-p gre
-j ACCEPT
# allow GRE
42 # reject (what to do with anything not allowed earlier)
43 iptables
-A INPUT
-p tcp
-j REJECT
--reject-with tcp-reset
44 iptables
-A INPUT
-j REJECT
--reject-with icmp-port-unreachable
47 ### (connections with the router as source)
50 iptables
-P OUTPUT DROP
51 iptables
-A OUTPUT
-m state
--state INVALID
-j DROP
52 iptables
-A OUTPUT
-m state
--state RELATED
,ESTABLISHED
-j ACCEPT
55 # insert accept rule or to jump to new accept-check table here
57 iptables
-A OUTPUT
-j output_rule
60 iptables
-A OUTPUT
-j ACCEPT
#allow everything out
62 # reject (what to do with anything not allowed earlier)
63 iptables
-A OUTPUT
-p tcp
-j REJECT
--reject-with tcp-reset
64 iptables
-A OUTPUT
-j REJECT
--reject-with icmp-port-unreachable
67 ### (connections routed through the router)
70 iptables
-P FORWARD DROP
71 iptables
-A FORWARD
-m state
--state INVALID
-j DROP
72 iptables
-A FORWARD
-p tcp
--tcp-flags SYN
,RST SYN
-j TCPMSS
--clamp-mss-to-pmtu
73 iptables
-A FORWARD
-m state
--state RELATED
,ESTABLISHED
-j ACCEPT
76 # insert accept rule or to jump to new accept-check table here
78 iptables
-A FORWARD
-j forwarding_rule
81 iptables
-A FORWARD
-i br0
-o br0
-j ACCEPT
82 iptables
-A FORWARD
-i $LAN -o $WAN -j ACCEPT
84 # reject (what to do with anything not allowed earlier)
85 # uses the default -P DROP
88 iptables
-t nat
-A PREROUTING
-j prerouting_rule
89 iptables
-t nat
-A POSTROUTING
-j postrouting_rule
90 iptables
-t nat
-A POSTROUTING
-o $WAN -j MASQUERADE
93 [ -f /etc
/firewall.user
] && .
/etc
/firewall.user
This page took 0.055065 seconds and 3 git commands to generate.