firewall.config 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. config defaults
  2. option syn_flood 1
  3. option input ACCEPT
  4. option output ACCEPT
  5. option forward REJECT
  6. # Uncomment this line to disable ipv6 rules
  7. # option disable_ipv6 1
  8. config zone
  9. option name lan
  10. list network 'lan'
  11. option input ACCEPT
  12. option output ACCEPT
  13. option forward ACCEPT
  14. config zone
  15. option name wan
  16. list network 'wan'
  17. list network 'wan6'
  18. option input REJECT
  19. option output ACCEPT
  20. option forward REJECT
  21. option masq 1
  22. option mtu_fix 1
  23. config forwarding
  24. option src lan
  25. option dest wan
  26. # We need to accept udp packets on port 68,
  27. # see https://dev.openwrt.org/ticket/4108
  28. config rule
  29. option name Allow-DHCP-Renew
  30. option src wan
  31. option proto udp
  32. option dest_port 68
  33. option target ACCEPT
  34. option family ipv4
  35. # Allow IPv4 ping
  36. config rule
  37. option name Allow-Ping
  38. option src wan
  39. option proto icmp
  40. option icmp_type echo-request
  41. option family ipv4
  42. option target ACCEPT
  43. config rule
  44. option name Allow-IGMP
  45. option src wan
  46. option proto igmp
  47. option family ipv4
  48. option target ACCEPT
  49. # Allow DHCPv6 replies
  50. # see https://dev.openwrt.org/ticket/10381
  51. config rule
  52. option name Allow-DHCPv6
  53. option src wan
  54. option proto udp
  55. option src_ip fe80::/10
  56. option src_port 547
  57. option dest_ip fe80::/10
  58. option dest_port 546
  59. option family ipv6
  60. option target ACCEPT
  61. config rule
  62. option name Allow-MLD
  63. option src wan
  64. option proto icmp
  65. option src_ip fe80::/10
  66. list icmp_type '130/0'
  67. list icmp_type '131/0'
  68. list icmp_type '132/0'
  69. list icmp_type '143/0'
  70. option family ipv6
  71. option target ACCEPT
  72. # Allow essential incoming IPv6 ICMP traffic
  73. config rule
  74. option name Allow-ICMPv6-Input
  75. option src wan
  76. option proto icmp
  77. list icmp_type echo-request
  78. list icmp_type echo-reply
  79. list icmp_type destination-unreachable
  80. list icmp_type packet-too-big
  81. list icmp_type time-exceeded
  82. list icmp_type bad-header
  83. list icmp_type unknown-header-type
  84. list icmp_type router-solicitation
  85. list icmp_type neighbour-solicitation
  86. list icmp_type router-advertisement
  87. list icmp_type neighbour-advertisement
  88. option limit 1000/sec
  89. option family ipv6
  90. option target ACCEPT
  91. # Allow essential forwarded IPv6 ICMP traffic
  92. config rule
  93. option name Allow-ICMPv6-Forward
  94. option src wan
  95. option dest *
  96. option proto icmp
  97. list icmp_type echo-request
  98. list icmp_type echo-reply
  99. list icmp_type destination-unreachable
  100. list icmp_type packet-too-big
  101. list icmp_type time-exceeded
  102. list icmp_type bad-header
  103. list icmp_type unknown-header-type
  104. option limit 1000/sec
  105. option family ipv6
  106. option target ACCEPT
  107. # include a file with users custom iptables rules
  108. config include
  109. option path /etc/firewall.user
  110. ### EXAMPLE CONFIG SECTIONS
  111. # do not allow a specific ip to access wan
  112. #config rule
  113. # option src lan
  114. # option src_ip 192.168.45.2
  115. # option dest wan
  116. # option proto tcp
  117. # option target REJECT
  118. # block a specific mac on wan
  119. #config rule
  120. # option dest wan
  121. # option src_mac 00:11:22:33:44:66
  122. # option target REJECT
  123. # block incoming ICMP traffic on a zone
  124. #config rule
  125. # option src lan
  126. # option proto ICMP
  127. # option target DROP
  128. # port redirect port coming in on wan to lan
  129. #config redirect
  130. # option src wan
  131. # option src_dport 80
  132. # option dest lan
  133. # option dest_ip 192.168.16.235
  134. # option dest_port 80
  135. # option proto tcp
  136. # port redirect of remapped ssh port (22001) on wan
  137. #config redirect
  138. # option src wan
  139. # option src_dport 22001
  140. # option dest lan
  141. # option dest_port 22
  142. # option proto tcp
  143. # allow IPsec/ESP and ISAKMP passthrough
  144. config rule
  145. option src wan
  146. option dest lan
  147. option proto esp
  148. option target ACCEPT
  149. config rule
  150. option src wan
  151. option dest lan
  152. option dest_port 500
  153. option proto udp
  154. option target ACCEPT
  155. ### FULL CONFIG SECTIONS
  156. #config rule
  157. # option src lan
  158. # option src_ip 192.168.45.2
  159. # option src_mac 00:11:22:33:44:55
  160. # option src_port 80
  161. # option dest wan
  162. # option dest_ip 194.25.2.129
  163. # option dest_port 120
  164. # option proto tcp
  165. # option target REJECT
  166. #config redirect
  167. # option src lan
  168. # option src_ip 192.168.45.2
  169. # option src_mac 00:11:22:33:44:55
  170. # option src_port 1024
  171. # option src_dport 80
  172. # option dest_ip 194.25.2.129
  173. # option dest_port 120
  174. # option proto tcp