MikroTik DNS Attack Prevention Rev 3.0


#########################################################################################################
#  Rick Frey's MikroTik DNS Attack Prevention Rev 3.0                                                   #
#########################################################################################################
# Author: Rick Frey                                                                                     #
# email: support@rickfreyconsulting.com                                                                 #
# Username in MikroTik Forum is rickfrey                                                                #
#########################################################################################################
#                                         License                                                       #
# This script has been created for use by the general public and may be used freely. This script may    #
# not be sold!                                                                                          #
########################################################################################################
# Features                                                                                              #                                                                             #
# -Mitigates DNS based attack on your MikroTik router                                                   #
#########################################################################################################

############################################################################################################################
#### Remove any private subnets that you are not using. Ensure that your LAN subnet is listed here.                       ##
############################################################################################################################
/ip firewall address-list
add address=10.0.0.0/8 list=DNS_Accept
add address=172.16.0.0/12 list=DNS_Accept
add address=192.168.0.0/16 list=DNS_Accept

############################################################################################################################
#### Add your DNS servers to the DNS_Accept list. Remove and DNS servers you are not using for your router.               ##
############################################################################################################################

add address=8.8.8.8/32 list=DNS_Accept disabled=no comment="Add DNS Server to this List"
add address=8.8.4.4/32 list=DNS_Accept disabled=no comment="Add DNS Server to this List"
add address=4.2.2.1/32 list=DNS_Accept disabled=no comment="Add DNS Server to this List"
add address=4.2.2.2/32 list=DNS_Accept disabled=no comment="Add DNS Server to this List"



/ip firewall filter
add action=jump chain=input comment="Jump to DNS_DDoS Chain" disabled=no jump-target=DNS_DDoS
add action=accept chain=DNS_DDoS comment="Make exceptions for DNS" disabled=no port=53 protocol=udp src-address-list=DNS_Accept
add action=accept chain=DNS_DDoS comment="Make exceptions for DNS" disabled=no dst-address-list=DNS_Accept port=53 protocol=udp
add action=add-src-to-address-list address-list=DNS_DDoS address-list-timeout=0s chain=DNS_DDoS comment="Add DNS_DDoS Offenders to Blacklist" disabled=no port=53 protocol=udp src-address-list=!DNS_Accept
add action=drop chain=DNS_DDoS comment="Drop DNS_DDoS Offenders" disabled=no src-address-list=DNS_DDoS
add action=return chain=DNS_DDoS comment="Return from DNS_DDoS Chain" disabled=no
/


MikroTik DNS Attack Prevention Rev 3.0


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 thoughts on “MikroTik DNS Attack Prevention Rev 3.0