firewall 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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://github.com/openwrt/openwrt/issues/5066
  51. config rule
  52. option name Allow-DHCPv6
  53. option src wan
  54. option proto udp
  55. option dest_port 546
  56. option family ipv6
  57. option target ACCEPT
  58. config rule
  59. option name Allow-MLD
  60. option src wan
  61. option proto icmp
  62. option src_ip fe80::/10
  63. list icmp_type '130/0'
  64. list icmp_type '131/0'
  65. list icmp_type '132/0'
  66. list icmp_type '143/0'
  67. option family ipv6
  68. option target ACCEPT
  69. # Allow essential incoming IPv6 ICMP traffic
  70. config rule
  71. option name Allow-ICMPv6-Input
  72. option src wan
  73. option proto icmp
  74. list icmp_type echo-request
  75. list icmp_type echo-reply
  76. list icmp_type destination-unreachable
  77. list icmp_type packet-too-big
  78. list icmp_type time-exceeded
  79. list icmp_type bad-header
  80. list icmp_type unknown-header-type
  81. list icmp_type router-solicitation
  82. list icmp_type neighbour-solicitation
  83. list icmp_type router-advertisement
  84. list icmp_type neighbour-advertisement
  85. option limit 1000/sec
  86. option family ipv6
  87. option target ACCEPT
  88. # Allow essential forwarded IPv6 ICMP traffic
  89. config rule
  90. option name Allow-ICMPv6-Forward
  91. option src wan
  92. option dest *
  93. option proto icmp
  94. list icmp_type echo-request
  95. list icmp_type echo-reply
  96. list icmp_type destination-unreachable
  97. list icmp_type packet-too-big
  98. list icmp_type time-exceeded
  99. list icmp_type bad-header
  100. list icmp_type unknown-header-type
  101. option limit 1000/sec
  102. option family ipv6
  103. option target ACCEPT
  104. config rule
  105. option name Allow-IPSec-ESP
  106. option src wan
  107. option dest lan
  108. option proto esp
  109. option target ACCEPT
  110. config rule
  111. option name Allow-ISAKMP
  112. option src wan
  113. option dest lan
  114. option dest_port 500
  115. option proto udp
  116. option target ACCEPT
  117. ### EXAMPLE CONFIG SECTIONS
  118. # do not allow a specific ip to access wan
  119. #config rule
  120. # option src lan
  121. # option src_ip 192.168.45.2
  122. # option dest wan
  123. # option proto tcp
  124. # option target REJECT
  125. # block a specific mac on wan
  126. #config rule
  127. # option dest wan
  128. # option src_mac 00:11:22:33:44:66
  129. # option target REJECT
  130. # block incoming ICMP traffic on a zone
  131. #config rule
  132. # option src lan
  133. # option proto ICMP
  134. # option target DROP
  135. # port redirect port coming in on wan to lan
  136. #config redirect
  137. # option src wan
  138. # option src_dport 80
  139. # option dest lan
  140. # option dest_ip 192.168.16.235
  141. # option dest_port 80
  142. # option proto tcp
  143. # port redirect of remapped ssh port (22001) on wan
  144. #config redirect
  145. # option src wan
  146. # option src_dport 22001
  147. # option dest lan
  148. # option dest_port 22
  149. # option proto tcp
  150. ### FULL CONFIG SECTIONS
  151. #config rule
  152. # option src lan
  153. # option src_ip 192.168.45.2
  154. # option src_mac 00:11:22:33:44:55
  155. # option src_port 80
  156. # option dest wan
  157. # option dest_ip 194.25.2.129
  158. # option dest_port 120
  159. # option proto tcp
  160. # option target REJECT
  161. #config redirect
  162. # option src lan
  163. # option src_ip 192.168.45.2
  164. # option src_mac 00:11:22:33:44:55
  165. # option src_port 1024
  166. # option src_dport 80
  167. # option dest_ip 194.25.2.129
  168. # option dest_port 120
  169. # option proto tcp