fbpx

How to restrict access to a list of websites from MikroTik? a kind of blacklist like in some proxies or watchguard.

To restrict access to a specific list of websites from a MikroTik device, you can use the firewall in conjunction with the Layer7 Protocols functionality to create a sort of blacklist.

This setting allows you to block traffic to certain websites based on the domain name. Here's how to configure it:

Step 1: Define Layer7 Protocols

First, you need to create a Layer7 rule that identifies traffic to the websites you want to block.

  1. Go to IP > Firewall and select the tab Layer7 Protocols.
  2. Click the add button (+) to create a new rule.
  3. In the countryside Name, give your rule a descriptive name.
  4. In the countryside Regexp, enter a regular expression that matches the domain names you want to block. For example, to block “example.com”, you can use: ^.+example\.com.*$If you want to block multiple sites, you can separate them with | (which means OR in regular expressions). For example: ^.+(example\.com|anotherexample\.com).*\$

Step 2: Create a Firewall Rule to Block Traffic

Now, you must create a rule in the firewall that uses the Layer7 rule you just defined to block traffic to those sites.

  1. Still in IP > Firewall, go to the tab Filter Rules.
  2. Click the add button (+) to create a new rule.
  3. Select the tab General and set Chain a forward.
  4. Go to the tab Advanced and field Layer7 Protocol, select the Layer7 rule you created earlier.
  5. Switch to tab Action, Select Action as drop to block traffic.

Step 3: Apply and Test

After configuring the rules, apply the changes and test to ensure that access to the specified sites is effectively blocked. Try accessing blocked websites from a device on your network to confirm that the block is working as expected.

Important considerations

  • HTTPS and Limitations: This method may not be effective for HTTPS sites, since the traffic is encrypted, and MikroTik does not inspect encrypted content without additional configurations such as an HTTP or HTTPS proxy. For effective HTTPS blocking, consider using a Web Proxy or DNS.
  • DNS usage: Another option is to block websites at the DNS level, restricting resolution of specific domain names or redirecting them to an invalid IP address. However, this requires that all clients on your network use the DNS configured on the MikroTik.
  • Maintenance: The website list and regular expressions will need regular maintenance and updates to ensure that blocking remains effective.

Remember that blocking access to websites must be done in accordance with acceptable use policies and respecting local and international privacy and censorship laws.

There are no tags for this post.
Did this content help you?
Facebook
Twitter
LinkedIn
WhatsApp
Telegram

Other documents in this category

Leave your comment

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

Tutorials available at MikroLABs

No Courses Found!

DISCOUNT CODE

AN24-LIB

applies to MikroTik books and book packs

Days
Hours
Minutes
Seconds

Introduction to
OSPF - BGP - MPLS

Sign up for this Free course

MAE-RAV-ROS-240118
Days
Hours
Minutes
Seconds

Sign up for this Free course

MAS-ROS-240111

Promo for Three Kings Day!

KINGS24

15%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the Three Kings Day discount code!

* promotion valid until Sunday January 7, 2024
** the code (KINGS24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

New Year's Eve Promo!

NY24

20%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the New Year's Eve discount code!

* promotion valid until Monday, January 1, 2024
** the code (NY24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

Christmas discounts!

XMAS23

30%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the discount code for Christmas!!!

**codes are applied in the shopping cart
Promo valid until Monday December 25, 2023

CYBER WEEK DISCOUNTS

CW23-MK

17%

all MikroTik OnLine courses

CW23-AX

30%

all Academy courses

CW23-LIB

25%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Cyber ​​Week!!!

**codes are applied in the shopping cart
Promo valid until Sunday December 3, 2023

BLACK FRIDAY DISCOUNTS

BF23-MX

22%

all MikroTik OnLine courses

BF23-AX

35%

all Academy courses

BF23-LIB

30%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Black Friday!!!

**Codes are applied in the shopping cart

codes are applied in the shopping cart
valid until Sunday November 26, 2023

Days
Hours
Minutes
Seconds

Sign up for this Free course

MAE-VPN-SET-231115

Halloween promo

Take advantage of discount codes for Halloween.

Codes are applied in the shopping cart

HW23-MK

11% discount on all MikroTik OnLine courses

11%

HW23-AX

30% discount on all Academy courses

30%

HW23-LIB

25% discount on all MikroTik Books and Book Packs

25%

Register and participate in the free course Introduction to Advanced Routing with MikroTik (MAE-RAV-ROS)

Today (Wednesday) October 11, 2023
7pm to 11pm (Colombia, Ecuador, Peru)

MAE-RAV-ROS-231011