Wednesday , 2 April 2025
Home » MikroTik » MikroTik’s Firewall Filter Rules

MikroTik’s Firewall Filter Rules

MikroTik’s Firewall Filter Rules

MikroTik’s firewall filter rules allow you to control traffic passing through your router. These rules are processed in the Firewall Filter section of IP > Firewall and help in securing networks by blocking or allowing specific traffic.

Firewall Filter Basics

Filter rules work in a chain-based manner. The three main chains are:

  • Input – Handles traffic directed to the router itself.
  • Output – Manages traffic generated by the router.
  • Forward – Filters traffic passing through the router.

Basic Firewall Rule Structure

Each rule consists of:

  • Chain (input, output, forward)
  • Source/Destination Address (IP ranges to filter)
  • Protocol (TCP, UDP, ICMP, etc.)
  • Action (accept, drop, reject, log, etc.)

Common Firewall Rules

Here are some useful MikroTik firewall filter rules:

1. Block All Incoming Traffic to Router (except SSH/Winbox)

/ip firewall filter add chain=input connection-state=invalid action=drop
/ip firewall filter add chain=input protocol=tcp dst-port=22,8291 action=accept
/ip firewall filter add chain=input action=drop

🔹 This ensures only SSH and Winbox access is allowed, while other incoming traffic is blocked.

2. Protect Against Ping Flood (ICMP Rate Limit)

/ip firewall filter add chain=input protocol=icmp limit=5,10 action=accept
/ip firewall filter add chain=input protocol=icmp action=drop

🔹 The first rule allows up to 5 pings per second, while the second rule drops excess pings.

3. Block Access to Specific Website (via DNS)

/ip firewall filter add chain=forward protocol=tcp dst-port=53 content="facebook.com" action=drop

🔹 This rule blocks access to facebook.com at the DNS request level.

4. Allow Only Certain IPs to Access a Server

/ip firewall filter add chain=forward src-address=192.168.1.100 dst-address=192.168.1.200 action=accept
/ip firewall filter add chain=forward dst-address=192.168.1.200 action=drop

🔹 Only IP 192.168.1.100 can reach 192.168.1.200, while others are blocked.

5. Block Specific Port (e.g., Torrent)

/ip firewall filter add chain=forward protocol=tcp dst-port=6881-6889 action=drop

🔹 Blocks torrent traffic that uses ports 6881-6889.


Firewall Rule Management

To view active firewall rules:

/ip firewall filter print

To remove a rule:

/ip firewall filter remove [find where comment="Block torrents"]

Check Also

BANDWIDTH MANAGEMENT ON MIKROTIK ROUTER

BANDWIDTH MANAGEMENT ON MIKROTIK ROUTER

BANDWIDTH MANAGEMENT ON MIKROTIK ROUTER BANDWIDTH MANAGEMENT ON MIKROTIK ROUTER, MikroTik routers are a popular …

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate »