Block Youtube Using Mikrotik

regex youtube mikrotik

Who doesn’t know Youtube? An online video platform that comes from Google and currently blocks the YouTube site using the proxy youtube regex. Nowadays, Youtube is also very reliable in making money from ads (advertisements). You can subscribe to follow videos that are always updated from one user. However, it could be that Youtube can be a barrier to a job.

How come? While studying online or at work, watching too many YouTube videos can become an addiction. Therefore, it is not surprising that many public facilities, offices, schools, or universities limit their internet use by blocking Youtube sites.

So, when you want to open the Youtube site, you can’t open it, while browsing the internet on other sites still can.

So, how do you block the Youtube site using the layer 7 protocol using Mikrotik?

Check other Access Point products from NetData:


Before you do this activity, prepare a few things first, because here you will use the Mikrotik Youtube regex technique. The Mikrotik setting technique used is:

  1. Address List Based on Domain Names
  2. Using Layer 7 Filtering
  3. Utilizing Web Proxy
  4. Using Mikrotik Static DNS The

equipment that you must prepare is:

  1. PC
  2. Mikrotik
  3. LAN cable
  4. Winbox software

An example for the topology is like this:


Block Youtube Sites Using Layer 7 Mikrotik Youtube Regex

To block Youtube sites by regex Youtube Mikrotik, follow the steps below:

  • Open the Winbox application on your PC.
  • Setting the IP address of the router that first accessed the PC by selecting IP >> Address. Add the router IP address on each PC according to the topology.

Blokir Situs Youtube Menggunakan Layer 7 Mikrotik

  • IP address settings on each PC in the Local Area Connection. Enter the IP address automatically.

Setting IP address

  • The next step is setting the DHCP Server.
  • Set menu IP >> DHCP Server. Later, the DHCP Server window will appear, then click DHCP Setup.
  • Then, select which interface will run the DHCP Server. Interface connected to the local network, namely “ether2”. Click Next.

DHCP Server

  • Next is the DHCP Client setting. This setting is done on a PC.
  • Connect the router 4 ethernet cable to the ISP.
  • In Winbox, go to IP >> DHCP Client.
  • Select the interface as a client, namely “ether 4”. Then click OK.
  • Make sure that the DHCP Client setting is in a bound situation as shown below. It can be observed that the IP DHCP Client is obtained automatically from the ISP.

DHCP Client

  • NAT
  • settings After setting the DHCP Client, then setting the NAT. Select the IP >> Firewall
  • menu. On the firewall menu, select the NAT menu. Then click “+”.
  • In the general menu, select the outgoing interface “ether 4” as via the internet connected.

ether 4

  • Select the action menu, then select the “masquerade” action.


  • Click OK. It can be observed that the NAT setting has been completed, as shown below:

setting NAT

Next Blocking Sites with Mikrotik Youtube regex. In this case, the site to be blocked is the website: Following are the steps to block the website using the Mikrotik Youtube regex method:

  1. Check first by opening, whether you can or not
  2. If you still can, next is blocking on the Youtube site. Go to IP> Firewall> Layer 7 Protocols menu. Select the “+” sign, then fill in as a blockable site. You can enter Regexp below:

^. + (Youtube). * $ | Oo.preferred.pttelkom- | | | c | | e. | | | | | | “| ( * $

Regex Youtube Mikrotik is scripting used to add content or the site to be blocked.

Regex Youtube Mikrotik

  • Setting the filter rules menu by selecting ip> firewall> filter rules, select the + sign. In the general menu, fill in add chain = forward src-address = (make sure first the source address has been obtained from the client from the ISP. Check the local area connection).

menu filter rules

menu filter rules

  • On the advice menu, fill in the layer 7 protocols that will be blocked.

firewall rule

  • On the action menu, choose the “drop” action so that the website to be blocked will be dropped later.

menu action

  • Once set, click OK. So that the configuration of blocking sites using layer 7 protocols is complete.
  • After all these processes have been done, try accessing the Youtube site. If successful, it will not be accessible later like this:

situs Youtube


Leave a Reply

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

Semua operasional PT. Network Data Sistem akan menggunakan domain per tanggal 8 Mei 2019. Semua informasi/promosi dalam bentuk apapun selain menggunakan domain bukan tanggung jawab PT. Network Data Sistem Dismiss