Page 1 of 1

Youtube allow 2 mb per user

Posted: Fri May 06, 2016 9:04 pm
by chhamza
help ...

I know it is possible to limit download and upload using a simple queue but what i was trying is that if i mark a limit say 512k download and 512k for upload then everything even youtube will also get 512k download and upload bandwidth. I want to make every connection to have 512k download and upload except youtube. can we make youtube to have 2mb bandwidth per user and other to have 256k speed.

Re: Youtube allow 2 mb per user

Posted: Fri May 06, 2016 9:08 pm
by ZeroByte
Not very easily, no.

I have to say I don't think I've ever seen anyone wanting to give YouTube MORE bandwidth than the standard per-user amount. ;)

If you really want to try - the best thing to do is to get a list of all of Google's IP ranges (they have several, obviously) from some source - such as a BGP looking-glass site (like BGP.he.net) and make an IP address-list of these prefixes, and then do your youtube matching based on the address-lists.

That wouldn't be totally clean though, because google drive, google hangout, any other google-hosted service would be subject to the 2M queue and not the 512K queue.

Re: Youtube allow 2 mb per user

Posted: Fri May 06, 2016 9:19 pm
by chhamza
can i get your email address ? please

Re: Youtube allow 2 mb per user

Posted: Sat May 07, 2016 9:36 am
by irghost
use layer7 protocol
^.+(youtube|googlevideo.com).*$
add action=add-dst-to-address-list address-list=youtube \
    address-list-timeout=12h chain=forward layer7-protocol=youtube
then add packet mark mangle for address-list
then add queue for this packet mark

its my idea

Re: Youtube allow 2 mb per user

Posted: Mon May 09, 2016 5:36 pm
by ZeroByte
layer7 protocol won't match SSL-protected connections, which Youtube forces. It may catch some connections if the user is typing a specific URL for youtube and they're not typing httpS:// at the beginning of their urls, but if they follow links, or click a "suggested video" - sooner or later they're going to hit a CDN node immediately with SSL and it's not going to be marked "youtube"

Re: Youtube allow 2 mb per user

Posted: Sun May 29, 2016 1:03 pm
by irghost
/ip firewall layer7-protocol
add name=youtubeBW regexp=^.+(youtube|googlevideo.com).*$

/ip firewall mangle
add action=mark-packet chain=forward comment=youtube layer7-protocol=\
    youtubeBW new-packet-mark="youtube packet"

/queue type
add kind=pcq name=PCQ pcq-classifier=dst-address pcq-dst-address6-mask=64 \
    pcq-rate=256k pcq-src-address6-mask=64

/queue simple
add limit-at=0/0 max-limit=256k/256k name=Youtube packet-marks=\
    "youtube packet" queue=PCQ/PCQ target=""

Re: Youtube allow 2 mb per user

Posted: Sun May 29, 2016 7:39 pm
by ZeroByte
This mangle rule won't work. Modify it to mark CONNECTION (not packet) and add another rule to mark packet if CONNECTION mark = YouTube.