firewall 3.8 KB

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