Beruflich Dokumente
Kultur Dokumente
This page is one of the main sites on the internet to find videos of any subject, there
are countless unimaginably shared content and it grows every day by being free and
anyone can upload material.
Next we show how to block the page and also how to modulate their video traffic.
Initially, for the two procedures, we must to make our Mikrotik router identify the
traffic generated by Youtube and their videos.
The first step will then create a new rule in IP - > Firewall -> Layer7 Protocol. Enter
the name of the rule Youtube and on the "Regex" field the following:
^.+(youtube).+$
With this we can control the traffic indicating "youtube". But we must also find
packages that are generated when playing a video, the files are hosted on the
subdomain "googlevideo.com". Similarly to the above procedure we do for clips. We
add a new rule on "Layer7 Protocol" called Googlevideo and in the following "Regex"
field:
^.+(googlevideo).+$
To mark this connection go IP -> Firewall -> Mangle tab. We make a new rule, in the
"General" tab, the Chain field is "PREROUTING" on the Advanced tab will be selected
in the Layer7-Protocol, "Youtube" and the Action we put "Mark-Connection" field
and then in Connection name "Youtube Conn", you click on the OK button.
We do this procedure again but with the rule Layer7 of "Googlevideo" and the
connection name must be like "Youtube Conn".
Now we will make another marking, also in the "Mangle" section, but this time will
be with traffic packets. In the "General" tab, the Chain field is "PREROUTING" and
right there we see the field called Connection Mark, we select the mark we did
before, "Youtube Conn", then in the "Action" tab, will be in Action, "Mark Packet"
and we'll put the name "Youtube".
Now we have all the packets marked Youtube, even those who go through the
https (443) port and thus we can handle it.
So we reject all traffic that has the mark and never reached its destination.
To limit the use of the internet, Queues are used, then the steps to follow:
Let’s go to the section Queues -> Queue Tree and create a new rule. In the name put
"Youtube", then the Parent field leave in "global" then Packet Marks must select the
packets that we marked the connections called "Youtube" later in the Queue Type
field must choose "PCQ-Download-Default". Now settings to limit the bandwidth.
The Limit-At field is to "reserve" a bandwidth when all resources are being used, for
example, suppose you have an internet connection of 5 Megas and are being
consumed all those 5 Megas, but if this Limit-At box has indicated 2 Megas, it will
reduce the consumption of everything else to give that 2 Megas of connection; for
our configuration it is not necessary to indicate a limitation of this type because
Youtube is not a critical service. In the box Max-Limit is where we draw the line we
want, until we want Youtube speed reaches, this is where we will be happy to control
the display quality of the videos on Youtube. If we want a video quality display we
can use this table:
Quality Speed
1080p 3M
720p 1500k
480p 1M
360p 750k
240p 500k
144p 250k
For the other values left as they are by default. If you desire you can configure the
switch Burst to give a burst of extra speed, but for our purpose is not necessary.
As we know, Youtube viewer use the best possible video quality and speed will
consume without restriction, but this rule can already tell you how much
consumption may thus restricting the quality of videos.
If we want a video just to be seen and heard, we will use 250kbps and so will not
affect other services that need internet bandwidth.
/queue tree
add max-limit=1M name=Youtube packet-mark=Youtube parent=global queue=pcq-download-default
Any additional questions can contact me via e-mail. I hope this guide helps
someone who need to do this procedure on a network, also to show that the
Mikrotik devices are the best.