How to block facebook in Mikrotik using L7 Protocols (Layer 7)

In Some Scenarios , We May need to Block Facebook Social Website or some others …In this tutorial, I will show you, how to achieve this goal using L7 (Layer7).

This tutorial consists of two parts:

1- Block facebook website for everyone on local network.

2- Allow facebook for specific host(s) and block for others on local network.

1- Block facebook website for everyone on local network.

First we check that Facebook is currently working on our local network or not?

Check the IP address of our client?

We need to create new Regexp rule at Layer7 Protocols, in order to block the facebook for our local network.

To achieve this goal, please follow these steps:


Now, we need to create Filter Rule, using these steps:

Now test the rule, that we just created:

Try also on 2nd client (

Check that it only block facebook or other websites also?

Oh yes, our rule is working perfectly 🙂

2- Allow facebook for specific host(s) and block for others on local network.

Now, we want to allow facebook for 2nd client ( but still want to block it for other host(s).

To accomplish this goal, we need to create a second Filter rule, to do this, please follow these steps:

Move this rule at the top:

Test this rule on 2nd client (

Verify the rule on Mikrotik:

Verify that, facebook is still blocked for other host(s) on the local network:

Verify the rule(s) on Mikrotik:

Drop packets rate are incremented!

We can do the same for youtube or any other website!

Hope this will help you!

Please Remember me in your prayers!

Enjoy 🙂

22 responses to “How to block facebook in Mikrotik using L7 Protocols (Layer 7)

  1. Vincenzo November 16, 2012 at 12:21 pm

    Good job. As easy as shoot a fish in a barrell. Can I link you to ?

  2. Frank DZANGUE March 6, 2013 at 8:57 pm

    excellent but connection on facebook using https protocol is still working

  3. Arbab March 7, 2013 at 5:38 am

    Mean, I was able to stop even session using the same setting

    • Semih March 13, 2013 at 8:33 pm

      sorry but it is working only with http protocol. if you try it over mozilla it is coming with https :(( how will we resolve that problem ??? do you have an idea ?

  4. Hengky June 13, 2013 at 8:49 am

    Yeah I also can’t block https://facebook when using Mozilla Firefox, even after applying those L7 rule.

  5. Phillip June 28, 2013 at 1:18 pm

    This method works well for me both http & https. but when users already have cache on their browser to blocking website, they still can access the same. Are their anyway to solve this?

  6. Nasir September 7, 2014 at 9:18 am

    Many Many Thanks

  7. Adiyadorj September 25, 2014 at 1:51 pm

    what mikrotik license level works it?

  8. Pierre April 23, 2015 at 10:14 pm

    Thank you very much, I would only like to remember that the order of rules is meaning full because if the ruler wich block facebook on both two computers on the LAN is the first, the ruler wich autorise the second computer can not work.

  9. archie November 18, 2015 at 10:08 pm

    It dons’t work for me. When running the test under IExplorer it seams to work, but in another like chrome not at all….

  10. afaq December 19, 2015 at 12:13 pm

    i m using level 6. after step 1 facebook has been blocked on whole network butt it is unable to allow specific people at step 2 as show above

  11. BP January 22, 2016 at 12:41 am

    Add protocol>TCP and Dst.Port 80,443 and then this setup will work. It starts to block Facebook

  12. Pingback: How to block facebook in Mikrotik using L7 Protocols | kitmana

  13. raka June 3, 2016 at 7:13 pm

    Nah… this layer 7 wont work if client/user using anonymox addons. I’ve tried it tbh.

  14. Moix August 20, 2016 at 11:38 am

    dear sir this role is working only dhcp computer but mikrotek cant acces the manual ip computer kindly define me solution for dhcp ip and manual ip computer

  15. Pingback: How to block using Layer 7 Mikrotik – Catatan harian wong-it .com

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: