fbpx

Can access to a site be restricted at certain hours on a MikroTik router?

Yes, you can restrict access to a website at certain hours using a MikroTik router. This can be achieved by creating rules in the firewall that block traffic to specific IP addresses or domain names during defined times. Here I explain how to do it step by step:

Step 1: Identify the IP Address or Domain Name

First, you need to identify the IP address or domain name of the website you want to restrict access to. Keep in mind that large websites may use multiple IP addresses or change them periodically.

Step 2: Create an Address List

Create a list in the MikroTik firewall for the website or websites you want to restrict access to.

/ip firewall address-list
add address=www.ejemplo.com list="Lista Sitios Restringidos"

Step 3: Create a Script to Enable and Disable the Lock

You will need two scripts: one to enable blocking and one to disable it. This is done to control access based on time.

  • Script to enable blocking:
/ip firewall filter
add action=drop chain=forward dst-address-list="Lista Sitios Restringidos" comment="Bloqueo Sitio Ejemplo"
  • Script to disable the lock:

You will need to remove the blocking rule. This can be done via the rule ID in the firewall.

/ip firewall filter remove [find comment="Bloqueo Sitio Ejemplo"]

Step 4: Configure the Scheduler

MikroTik RouterOS allows you to configure scheduled tasks (Scheduler) to run scripts at specific times.

  • To enable blocking:
/system scheduler
add name="Habilitar Bloqueo Sitio" start-date=jan/01/1970 start-time=00:00:00 interval=1d on-event="NombreScriptHabilitarBloqueo"
  • To disable the lock:
/system scheduler
add name="Deshabilitar Bloqueo Sitio" start-date=jan/01/1970 start-time=08:00:00 interval=1d on-event="NombreScriptDeshabilitarBloqueo"

Note: You must adjust the schedules (start-time) based on the specific hours you want to restrict access. Additionally, it is important to remember that blocking by domain name may not be completely effective if the site uses CDNs or has multiple IP addresses. In those cases, blocking by IP address may be more effective but requires keeping the site's IP list updated.

These steps will allow you to configure your MikroTik router to restrict access to specific websites during the hours you choose. Please note that the exact names of the commands and options may vary slightly depending on the version of RouterOS you are using.

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