How to block Facebook, Twitter, Youtube on Mikrotik

In case you want to block access to Facebook, Twitter, Youtube or other websites, it is easy to do this job on Mikrotik RouterOS. You can use either web proxy or directly from firewall rule to block websites.

According to Mikrotik Wiki, you can block users from accessing websites using content option in Mikrotik Firewall rule. One rule per content you want to block. So if you want to block, for example, Facebook, Youtube, and Twitter, you have to create rule for each content.

Here’s I show you how to block websites (e.g. Facebook, Youtube, and Twitter) using Firewall Rule in Mikrotik RouterOS. Change the src-address value to the source of IP addresses you want to block.

Drop Access to Facebook

/ip firewall filter add chain=forward src-address=192.168.1.0/24 protocol=tcp 
dst-port=80 content="facebook" action=drop comment="Block Facebook HTTP"

/ip firewall filter add chain=forward src-address=192.168.1.0/24 protocol=tcp 
dst-port=443 content="facebook" action=drop comment="Block Facebook HTTPS"

Drop Access to Youtube

/ip firewall filter add chain=forward src-address=192.168.1.0/24 protocol=tcp 
dst-port=80 content="youtube" action=drop comment="Block Youtube HTTP"

/ip firewall filter add chain=forward src-address=192.168.1.0/24 protocol=tcp 
dst-port=443 content="youtube" action=drop comment="Block Youtube HTTPS"

Drop Access to Twitter

/ip firewall filter add chain=forward src-address=192.168.1.0/24 protocol=tcp 
dst-port=80 content="twitter" action=drop comment="Block Twitter HTTP"

/ip firewall filter add chain=forward src-address=192.168.1.0/24 protocol=tcp 
dst-port=443 content="twitter" action=drop comment="Block Twitter HTTPS"

Now try to access those website above. If the above rules work properly, you should not be able to access those website now.

  • Habib Malwan

    this Rule didnt work for me is there any thing i have to check out for.

  • Vantha Seng

    cannot block https facebook when i follow this step.
    thank for help me.

    • Habib Malwan

      For me it not blocking any thing at all

  • Shomy The Homie

    Is there some way to block streaming of videos, and use of wildcards to that it drops keywords like “tube” “book” “xxx”. Thank you.

  • Dod888

    One problem is the rules rendered useless when the user connect through https://www.facebook.com
    Do you have a solution for this problems?

    • Hi, this is already done in the example above. You have to drop access to facebook with the destination port of 443 (HTTPS)

  • SIVLE

    Congratulations to these works, many are saying that this can not be solved by the filters, thanks for your help.

    • Mikaso

      Yes, but this solution also block every website with facebook content!

      • Yes you’re right. It is because the websites with facebook content render facebook.com in the background.