Как заблокировать youtube на роутере mikrotik

Время на прочтение
3 мин

Количество просмотров 173K

На написание данной статьи меня сподвиг тот факт, что старший ребенок стал по ночам вместо того чтобы укладываться спать, смотреть на своем смартфоне всякие ролики на youtube, до поздней ночи, а так же замена домашнего роутера с TP-Link TL-WR1043ND на MikroTik RB951G-2HnD.

Поизучав интернеты, наткнулся на презентацию от 2017 года на канале микротика в ютубе. Там описывалось, как не надо делать и как делать правильно. Возможно, для многих продвинутых пользователей MikroTik и RouterOS это не будет открытием, но надеюсь что поможет начинающим пользователям, как я, не заблудиться в дебрях вариантов, предлагаемых в интернете.

Начнем с часто предлагаемого варианта в интернете (так не надо делать!!!):

● /ip firewall layer7-protocol
add name=youtube regexp="^.+(youtube).*$"
add name=facebook regexp="^.+(facebook).*$"

● /ip firewall filter
add action=drop chain=forward layer7-protocol=facebook
add action=drop chain=forward layer7-protocol=youtube

У данного решения следующие минусы: высокая нагрузка на cpu, увеличенная latency, потеря пакетов, youtube и facebook не блокируются.

Почему так происходит? Каждое соединение проверяется снова и снова, Layer7 проверяется не в том месте, что приводит к проверке всего трафика.

Правильное решение

Создаем правило с регулярным выражением для Layer7:

● /ip firewall layer7-protocol
add name=youtube regexp="^.+(youtube).*$"

Я блочил только ютуб, если нужен фейсбук или что-то иное, создает отдельные правила

add name=facebook regexp="^.+(facebook).*$"

Можно создавать правила и для других сервисов стримминга видео, вот один из вариантов:

regexp=”^.*youtube.com|youtu.be|netflix.com|vimeo.com|screen.yahoo.com|dailyMotion.com|hulu.com|twitch.tv|liveleak.com|vine.co|break.com|tv.com|metacafe.com|viewster.com).*$”

Далее создаем правила для маркировки соединений и пакетов:

● /ip firewall mangle
add action=mark-connection chain=prerouting protocol=udp 
dst-port=53 connection-mark=no-mark layer7-protocol=youtube new-connection-mark=youtube_conn passthrough=yes 
add action=mark-packet chain=prerouting connection-mark=youtube_conn new-packet-mark=youtube_packet

и правила для фильтра файрвола:

● /ip firewall filter
add action=drop chain=forward packet-mark=youtube_packet
add action=drop chain=input packet-mark=youtube_packet

У меня в домашней сети по dhcp раздаются статические ip-адреса, поэтому фильтр я применял к ip-адресу смартфона ребенка, можно создать группу адресов и применить к ней. Идем в меню IP>Firewall>AddressList нажимаем кнопку Add, вводим название группы и не забываем заполнить список адресов для блокировки.

Далее идем меню IP>Firewall>Mangle выбираем наши mark_connection и mark_packet и в поле Src. Address вбиваем блокируемый ip либо группу.

Все, девайс остался без ютуба, жестко, но в воспитательных целях нужно.

Так же можно применять эти правила по расписанию.

Буду рад комментариями и поправкам, если вы заметите какие то неточности, т.к. это моя первая статья на Хабре. По материалам канала MikroTik на Youtube. Внимание, эта статья не о том как ограничить доступ ребенку в интернет, ограничение доступа в ютуб — это просто пример. Статья об одном из способов ограничения доступа к нежелательным ресурсам.

Updt1, от avelor, блок по mac:

 ● /ip firewall filter
    add chain=input src-mac-address=aa:bb:cc:dd:ee:ff action=drop
    add chain=forward src-mac-address=aa:bb:cc:dd:ee:ff action=drop

можно заблочить и в dhcp — сделать lease и жмякнуть block access

Возникла необходимость заблокировать Youtube в сети, где шлюзом выступает роутер MikroTik BR750Gr3. Первоначальные настройки роутера выполнены по этой  инструкции.

Освоить MikroTik Вы можете с помощью онлайн-куса
«Настройка оборудования MikroTik». Курс содержит все темы, которые изучаются на официальном курсе MTCNA. Автор курса – официальный тренер MikroTik. Подходит и тем, кто уже давно работает с микротиками, и тем, кто еще их не держал в руках. В курс входит 162 видеоурока, 45 лабораторных работ, вопросы для самопроверки и конспект.

Информация по блокировке взята отсюда.

В сокращенном виде терминальных команд это выглядит так:

/ip firewall mangle

add action=mark-connection chain=prerouting protocol=udp

dst-port=53 connection-mark=no-mark layer7-

protocol=youtube new-connection-mark=youtube_conn

passthrough=yes

add action=mark-packet chain=prerouting connectionmark=youtube_conn new-packet-mark=youtube_packet

/ip firewall filter

add action=drop chain=forward packet-mark=youtube_packet

add action=drop chain=input packet-mark=youtube_packet

(Нажимаем в роутере New Terminal и вводим построчно команды)

Принцип действия таков: мы маркируем соединения и пакеты, относящиеся к ютубу, затем правилами фаервола их блокируем.

Для тех, кто всё понял, дальше может не читать.

В микротик рекомендуют такой способ вместо одиночного правила блокировки т.к. он снижает нагрузку на оборудование.

Помимо настроек через команды, написанные выше, настройки можно выполнить через графический интерфейс. Рассмотрим этот способ подробнее.

Подключаемся к роутеру через WinBox.

Переходим по пути меню: IP>>Firewall>>Layer7 Protocols

Нажимаем синий плюсик и создаем новое правило.

В поле Name пишем имя youtube.

В поле Regexp: вводим значение для идентификации ютуба   ^.+(youtube).*$

* если необходимо заблокировать социальные сети или другие ресурсы, то необходимо создать правила с другими идентификаторами (доменными именами)

Создадим два правила для маркировки соединений и пакетов.

Переходим на вкладку Mangle. Нажимаем синий плюсик.

В открывшемся окне на вкладке General вводим значения, как на скриншоте ниже:

Chain: prerouting.

Src.Address: 192.168.x.x (адрес ПК, у которого нужно заблокировать доступ на ютуб, src – исходящий адрес, dst – адрес назначеня).

Protocol: udp.

Dst.port: 53.

Connection Mark: no-mark

Нажимаем кнопку «Apply».

Переходим на вкладку Advanced.

Layer7 Protocol: youtube

Переходим на вкладку Action, выполняем настройки.

Action: mark connection

New Connection Mark: youtube_conn

Passthrough – активируем галочкой.

Нажимаем Apply или OK.

Этим правилом мы будем маркировать все соединения с ютуб именем youtube_conn.

Создаем еще одно правило на вкладке Mangle нажав синий плюсик.

В открывшемся окне, на вкладке General вводим значения, как на скриншоте ниже:

Chain: prerouting.

Src.Address: 192.168.x.x (адрес ПК, у которого нужно заблокировать доступ на ютуб).

Connection Mark: youtube_conn.

Нажимаем кнопку «Apply».

Переходим на вкладку Action, выполняем настройки.

Action: mark packet

New Connection Mark: youtube_packet

Passthrough – активируем галочкой.

Нажимаем Apply или OK.

Этим правилом мы будем маркировать все пакеты ютуба.

Получилось два правила.

Переходим на вкладку Filter Rules. Создаем правило, нажав плюс.

Выполняем настройки. На вкладке General:

Chain: forward.

Packet Mark: youtube_packet.

Переходим на вкладку Action.

Action: drop

Можно добавить комментарий к правилу.

Нажимаем Apply или ОК. Правило готово.

Создадим еще одно правило в этом же разделе (Filter Rules).

На вкладке General отмечаем:

Chain: input

Packet Mark: youtube_packet

Переходим на вкладку Action.

Action: drop

Добавляем комментарий.

Нажимаем Apply, чтоб сохранить правило.

В итоге получились два правила.

После этих действий YouTube на компьютере перестал работать.

Блокировка ресурса для нескольких пользователей.

Если нужно заблокировать доступ на YouTube для большого числа пользователей создадим группу пользователей и применим правила к ней.

Переходим по пути: IP>>Firewall>>Address Lists

Нажимаем синий плюсик.

В открывшемся окне New Firewall Address List пишем название группы и диапазон необходимых IP-адресов. Нажимаем ОК.

Если работает DHCP, то правило будет применяться только к этому диапазону IP, нужно учитывать этот нюанс. Либо привязать MAC  адрес пользователя к определенному IP, и ему всегда будет раздаваться один и тот же IP либо прописать у всех пользователей сети статические IP адреса. Или какие-то другие варианты.

Переходим на вкладку Mangle, выбираем по очереди два наших созданных ранее правила по маркировке соединений и пакетов. В разделе General из строчки Src.Address убираем IP адрес, а на вкладке Advanced добавляем в строчке Src.Address List созданную группу. ОК.

После этих действий YouTube заблокируется у группы пользователей с перечисленным диапазоном IP адресов.

Иногда может потребоваться некоторое время, чтоб правило начало действовать.

Если есть какие-то другие запрещающие правила в списке фаервола, то данные правила лучше разместить выше них (или по обстоятельствам, в соответствии с тем, что и  как блокируется).

Разрешение доступа на YouTube определенным пользователям и запрет всем остальным.

Если нужно заблокировать ютуб всем пользователям и только определенным оставить, создаем группу GR3, в которою добавляем IP адреса пользователей, которым нужно разрешить доступ в YouTube.

Если нужны какие-то определенные IP-адреса, помимо перечисленного диапазона, то создаем еще один объект в разделе Address Lists, называем его точно так же и добавляем в него нужный IP.

С помощью консольной команды это можно сделать так:

/ip firewall address-list add list=GR3 address=192.168.0.60

Таким способом добавляем все нужные адреса.

Создаем группу GR5, в которую добавляем все IP-адреса сети.

В двух правилах на вкладке Mangle в разделе Advanced указываем созданную группу со всеми IP адресами. OK.

В двух правилах на вкладке Firewall в разделе General указываем диапазон всех IP-адресов сети в поле Src.Address.

Переходим на вкладку Advanced и в поле Src.Address выбираем группу пользователей, которым доступ разрешен. Важный момент – отмечаем значок «!» в квадратике слева от выбранной группы. Он означает инверсию действия, т.е. вместо запрещения разрешение. Нажимаем ОК.

Смысл всех этих действий таков: Соединения и пакеты Ютуба будут маркироваться для всех пользователей сети. Фильтр фаервола будет обрывать (drop) маркированные соединения и пакеты всем пользователям, за исключением пользователей группы GR3, для которых действие наоборот, т.е. разрешающее.

Вероятно, что есть и другие варианты для решения вопроса блокировки ресурса через MikroTik. Представленная схема проверена и работает в сети нашей организации. Обладая вышеописанными знаниями по маркировке и работе с группами можно создавать и комбинировать правила для блокировки/разрешения доступа к различным ресурсам интернета разным пользователям различными вариантами.

Освоить MikroTik Вы можете с помощью онлайн-куса
«Настройка оборудования MikroTik». Курс содержит все темы, которые изучаются на официальном курсе MTCNA. Автор курса – официальный тренер MikroTik. Подходит и тем, кто уже давно работает с микротиками, и тем, кто еще их не держал в руках. В курс входит 162 видеоурока, 45 лабораторных работ, вопросы для самопроверки и конспект.

На написание данной статьи меня сподвиг тот факт, что клиенту понадобилось блокировать трафик на развлекательные сайты. Поизучав интернеты, наткнулся на презентацию от 2017 года на канале микротика в ютубе. Там описывалось, как не надо делать и как делать правильно. Возможно, для многих продвинутых пользователей MikroTik и RouterOS это не будет открытием, но надеюсь что поможет начинающим пользователям, как я, не заблудиться в дебрях вариантов, предлагаемых в интернете.

Освоить MikroTik вы можете с помощью онлайн-курса «Настройка оборудования MikroTik». В курсе изучаются все темы из официальной программы MTCNA. Автор – официальный тренер MikroTik. Материал подходит и тем, кто уже давно работает с оборудованием MikroTik, и тем, кто еще не держал его в руках. В состав входят 162 видеоурока, 45 лабораторных работ, вопросы для самопроверки и конспект.

Для тех кто не хочет тратить своё дорогое время на изучение данного мануала предлагаем нашу платную помощь.

Начнем с часто предлагаемого варианта в интернете:

/ip firewall layer7-protocol add name=youtube regexp=«^.+(youtube).*\$» add name=facebook regexp=«^.+(facebook).*\$»

/ip firewall filter add action=drop chain=forward layer7-protocol=facebook

add action=drop chain=forward layer7-protocol=youtube

У данного решения следующие минусы: высокая нагрузка на cpu, увеличенная latency, потеря пакетов, youtube и facebook не блокируются. 

Почему так происходит? Каждое соединение проверяется снова и снова, Layer7 проверяется не в том месте, что приводит к проверке всего трафика.

Мы немного доработаем этот метод блокировки. Читайте далее.

Правильное решение

Создаем правило с регулярным выражением для Layer7:

/ip firewall layer7-protocol add name=youtube regexp=«^.+(youtube).*\$»

wsocqi2uofaxdzpyzopaljhlsxo

Я блочил только ютуб, если нужен фейсбук или что-то иное, создает отдельные правила:

add name=facebook regexp=«^.+(facebook).*\$»

Можно создавать правила и для других сервисов стримминга видео, вот один из вариантов поля Regexp: 

^.*(youtube.com|youtu.be|netflix.com|vimeo.com|screen.yahoo.com|metacafe.com|viewster.com).*$

Далее создаем правила для маркировки соединений и пакетов:

/ip firewall mangle add action=mark-connection chain=prerouting protocol=udp dst-port=53 connection-mark=no-mark layer7-protocol=youtube new-connection-mark=youtube_conn passthrough=yes

dr6taoteeod glxk856fzz3kxgq

*Можно создать это правило на весь трафик, а не только на DNS. Нагрузка при этом но роутер возрастёт, но вы гарантированно закроете пользователям доступ к нужным сайтам.

add action=mark-packet chain=prerouting connection-mark=youtube_conn new-packet-mark=youtube_packet

mmic is7mesjcb6m d32rknjmjo

и правила для фильтра файрвола:

/ip firewall filter add action=drop chain=forward packet-mark=youtube_packet

add action=drop chain=input packet-mark=youtube_packet

kcev 1fvonj161k8ril5xz8hmf8

crgynsgkswduttbf2vrp9pk62ac

У меня в домашней сети по dhcp раздаются статические ip-адреса, поэтому фильтр я применял к ip-адресу клиента, можно создать группу адресов и применить к ней. Идем в меню IP>Firewall>AddressList нажимаем кнопку Add, вводим название группы и не забываем заполнить список адресов для блокировки.

Далее идем меню IP>Firewall>Mangle выбираем наши mark_connection и mark_packet и в поле Src. Address вбиваем блокируемый ip либо группу.

qgcrxx6tzlwxknramhoh6kfbxf4

Так же можно применять эти правила по расписанию.

Буду рад комментариями и поправкам, если вы заметите какие то неточности. По материалам канала MikroTik на Youtube. Внимание, эта статья не о том как ограничить доступ в интернет, ограничение доступа в ютуб — это просто пример. Статья об одном из способов ограничения доступа к нежелательным ресурсам.

Автор: Сергей Стрельцов

Дорабатывал статью Кардаш Александр Владимирович

Очень похоже что статья устарела. Смотрите её обновлённый вариант

Освоить MikroTik вы можете с помощью онлайн-курса «Настройка оборудования MikroTik». В курсе изучаются все темы из официальной программы MTCNA. Автор – официальный тренер MikroTik. Материал подходит и тем, кто уже давно работает с оборудованием MikroTik, и тем, кто еще не держал его в руках. В состав входят 162 видеоурока, 45 лабораторных работ, вопросы для самопроверки и конспект.

yahyamemeh

just joined

Posts: 3
Joined: Sun Aug 07, 2022 2:10 pm

Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 1:49 pm

Hello everyone;

I would like to ask how to block youtube (or facebook) website and apps using Mikrotik RB951Ui-2HnD
Note that I tried using layer7 filtering, I tried what was said in this video:
https://www.youtube.com/watch?v=D80_a_O … 13&index=7, MIN: 3:30

Note that modern web browser uses QUIC, note also that android apps can not be blocked using Layer 7 filtering
Note that blocking all youtube ip addresses would be inefficient to me.

I tried every possible way I saw on the Internet but didn’t work with me, I would really appreciate your help.
Thanks in advance.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 3:12 pm

block youtube:

layer7 filtering useless with HTTPS.
+
modern web browser uses QUIC
+
android apps can not be blocked using Layer 7 filtering
+
blocking all youtube ip addresses would be inefficient to me
+
I tried every possible way I saw on the Internet but didn’t work with me
+
supposed: no control on user devices
+
supposed: do not want spend $50.000 and more for non-mikrotik deep packet inspection machine or similar
=
IS-NOT-POSSIBLE

And before open useless topic for the same arguments already present dozen of times, at least deign to do a search on the forum.

User avatar
Znevna

Forum Guru
Forum Guru

Posts: 1352
Joined: Mon Sep 23, 2019 1:04 pm

Re: Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 3:14 pm

you unplug the PCs from internet, turn off the routers and turn off mobile data.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 3:20 pm

:shock: It is true! Just remove the internet from users!!! Why I didn’t think about it before???

(sorry, I’m stupid)

holvoetn

Forum Guru
Forum Guru

Posts: 3817
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 3:33 pm

you unplug the PCs from internet, turn off the routers and turn off mobile data.

One could still use RFC2549 … even under those conditions.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 4:04 pm

RFC2549 has been outdated few years ago… Why don’t you update?

RFC9200

User avatar
Znevna

Forum Guru
Forum Guru

Posts: 1352
Joined: Mon Sep 23, 2019 1:04 pm

Re: Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 4:10 pm

Please use the updated RFC 6214, thank you.
Regards,
Also the topic you recently closed is older than this current one (check the time ^^)
viewtopic.php?t=188274

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 4:16 pm

@Znevna

Is hard to join all «block youtube» topics and concentrate all in one… (with something usable)

¯\_(ツ)_/¯

User avatar
Znevna

Forum Guru
Forum Guru

Posts: 1352
Joined: Mon Sep 23, 2019 1:04 pm

Re: Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 4:20 pm

But truth be told, there are services like NextDNS that manage to block youtube, probably just at a DNS level, you could impose some restrictions on clients, I think, the same service blocks bypass methods, I’ve mentioned this before.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Tue Aug 09, 2022 4:27 pm

+
supposed: no control on user devices
+

Unfortunately, not being able to control users’ devices, DoH/DoQ/DoT/VPN are simply enough….

reinerotto

Long time Member
Long time Member

Posts: 518
Joined: Thu Dec 04, 2008 2:35 am

Re: Block Youtube on computers and smartphone apps

Wed Aug 10, 2022 10:04 pm

The only real problem is the usage of VPN.
Everything else can be taken care of.

User avatar
Jotne

Forum Guru
Forum Guru

Posts: 3221
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block Youtube on computers and smartphone apps

Wed Aug 10, 2022 11:08 pm

Do you say that you can stop me from browsing where I want without having 100% control of the client? PC/Mobil etc.
How do you block DoH/DoQ/DoT?

yahyamemeh

just joined

Topic Author

Posts: 3
Joined: Sun Aug 07, 2022 2:10 pm

Re: Block Youtube on computers and smartphone apps

Thu Aug 11, 2022 8:46 am

block youtube:

layer7 filtering useless with HTTPS.
+
modern web browser uses QUIC
+
android apps can not be blocked using Layer 7 filtering
+
blocking all youtube ip addresses would be inefficient to me
+
I tried every possible way I saw on the Internet but didn’t work with me
+
supposed: no control on user devices
+
supposed: do not want spend $50.000 and more for non-mikrotik deep packet inspection machine or similar
=
IS-NOT-POSSIBLE

And before open useless topic for the same arguments already present dozen of times, at least deign to do a search on the forum.

I would provide a report to this reply since you verbal abuse for no reason. Hope admins will react in a good way with such a kind of replies.
Since you have no reply with useful information and don’t like this post, you should have skip it instead of acting this rude.

yahyamemeh

just joined

Topic Author

Posts: 3
Joined: Sun Aug 07, 2022 2:10 pm

Re: Block Youtube on computers and smartphone apps

Thu Aug 11, 2022 8:54 am

As a new user in the forums I’m totally surprised in the comments that may seam coming from people lack knowledge or lack behaviors.

Hope moderators would take appropriate actions.

User avatar
Znevna

Forum Guru
Forum Guru

Posts: 1352
Joined: Mon Sep 23, 2019 1:04 pm

Re: Block Youtube on computers and smartphone apps

Thu Aug 11, 2022 9:05 am

What was rude about telling you that you can’t do it?

User avatar
BartoszP

Forum Guru
Forum Guru

Posts: 2753
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Block Youtube on computers and smartphone apps

Thu Aug 11, 2022 9:58 am

Primo: Rextended just suggested to do a «Search» and you can find a lot of info.

Secundo: The youtube film was about «Holy war against >>masquarade<<» what is loosely connected to «how to efficently block using L7 filters» even if it was mentioned there.

Tertio: … you want to block YouTube while learning yourself from YouTube …. kind of technical oxymoron :) :) :)

a8.PNG

You do not have the required permissions to view the files attached to this post.

fmodolo

just joined

Posts: 2
Joined: Tue Feb 21, 2017 10:50 am

Re: Block Youtube on computers and smartphone apps

Wed Oct 05, 2022 9:18 am

I had the same problem in the past, and I soon realized I had to replace with a firewall with application control. You don’t really need to spend billions, depending on your needs you can find consumer devices that do the job at a very low prices. The solution provided in the previous post is still good, using a dns service (you can even find free ones) that allows you to configure specific blocks. Take into account that in this case, you need to prevent users from using different dns. Mikrotik is mostly a powerful router, but when L7 comes into account, you need other options. I agree with you that in this forum, I’would’t expect people to answer «disable internet to users»

User avatar
normis

MikroTik Support
MikroTik Support

Posts: 25907
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Block Youtube on computers and smartphone apps

Wed Oct 05, 2022 9:20 am

Depending on your needs, you could go the opposite way, allow the sites you really need, then block everything else. This will certainly block youtube.
If you need to ONLY block youtube … I simply can’t imagine why?

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Wed Oct 05, 2022 10:49 am

I think that with all the means that are available now (ignoring VPN & Co.),
thinking of blocking something like youtube, that uses CDNs, shared servers, and part of those servers forcefully must be allowed for use other wanted sites,
is impossible.
Also because trivially in Firefox just click on «Use DoH NextDNS», and you end up with DNS via HTTPS on CDNs, and not on static IPs…

jovaf32128

just joined

Posts: 24
Joined: Sun Apr 26, 2020 9:22 pm

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 4:45 pm

modern web browser uses QUIC

/ip firewall raw add action=drop chain=prerouting comment="Ban QUIC" dst-port=443 protocol=udp

And modern browsers have started supporting HTTPS. Voila!

Last edited by jovaf32128 on Thu May 11, 2023 12:26 pm, edited 1 time in total.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 5:04 pm

«Voilà! shit», but have you tried it?
Browsers will still use https/TLS anyway,
it’s not that QUIC is the only thing that exists.

User avatar
mozerd

Forum Veteran
Forum Veteran

Posts: 864
Joined: Thu Oct 05, 2017 3:39 pm
Location: Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 5:24 pm

@yahyamemeh

MikroTik Routers and RouterOS cannot do Deep Packet Inspection [DPI] so any site that uses HTTPS:\\ [like YouTube, Facebook, etc.] cannot be inspected and blocked …. to do that you need to have the Router/Hardware capable of doing DPI efficiently without impacting performance greatly … Those type of Router systems are generally defined as Content Management Systems [CMS].

If that interest you then Vendors like DrayTek and their Vigor2962/3910 routers can do it nicely — for those type of devices the CMS portion usually has an licensing cost associated to the CMS modules as addons …

You could capture the IP Addresses that YouTube uses and then creates an YTBlock List that contains those IP’s then in Filter RAW create a block rule and that would be effective for as long as those IP are active … YouTube do change their IP’s from time to time so you have to stay on top of that to keep your block list current.

There are some creative ways of getting YouTube addresses from the following link:
https://stackoverflow.com/questions/934 … dows-firew

Last edited by mozerd on Sat Jan 28, 2023 5:36 pm, edited 1 time in total.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 5:28 pm

Yes,

the solution to this topic is still the post #2…

User avatar
Larsa

Forum Veteran
Forum Veteran

Posts: 892
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa’s Workshop

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 6:06 pm

MikroTik Routers and RouterOS cannot do Deep Packet Inspection [DPI] so any site that uses HTTPS:\\ [like YouTube, Facebook, etc.] cannot be inspected and blocked …. to do that you need to have the Router/Hardware capable of doing DPI efficiently without impacting performance greatly … Those type of Router systems are generally defined as Content Management Systems [CMS].

If that interest you then Vendors like DrayTek and their Vigor2962/3910 routers can do it nicely — for those type of devices the CMS portion usually has an licensing cost associated to the CMS modules as addons …

DPI (Deep Packet Inspection) is currently impossible to perform on standard encrypted payloads which is what almost all traffic is these days, thus you have just IP address and port number to play with. Also, there is no hardware that can crack today’s encryption algorithms and decrypt traffic in real-time. It’s worth noticing that the most current algorithms are also quantum-safe.

There are some very specific solutions targeted at enterprise that disconnect certificates with a “man-in-the-middle” encryption server, but since end-to-end encryption (“aka zero trust”) is more or less standard in modern software, MitM solutions will soon become outdated as well. Moreover, that solution is also extremely expensive and cumbersome to implement because it requires extensive changes on all clients.

Bottom line, there are no standard firewalls or/and CMSs that can perform DPI, dynamic application routing, firewall L7 filtering or whatever you want to call this for the reasons explained above.

User avatar
anav

Forum Guru
Forum Guru

Posts: 17447
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 6:26 pm

Excellent clear and honest advice rextended. Much appreciated.
Also Normis……… why! Concur, sometimes one needs to invoke something called parenting or business employee rules ( as in how to get fired ).

As for yahm……..
https://media.tenor.com/DGlbJWqzeNEAAAA … -truth.gif

User avatar
Larsa

Forum Veteran
Forum Veteran

Posts: 892
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa’s Workshop

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 6:51 pm

Regarding the OP and how to block Youtube, here are my two recommendations where both should be used together for best effect:

1. Firstly and if it’s not for personal use I would subscribe to a service otherwise I’d use a tool like iplist-youtube to get the most current ip addresses for a blocklist. If you don’t want to host and run «iplist-youtube» yourself, the address lists are updates every 5 minutes and are available here

— Ipv4 list raw link => https://raw.githubusercontent.com/touhidurrr/iplist-youtube/main/ipv4_list.txt
— Ipv6 list raw link => https://raw.githubusercontent.com/touhidurrr/iplist-youtube/main/ipv6_list.txt

2. Implement pi-hole or similar.

Many cruise ships and airlines block YouTube and similar streaming services by using specialized providers that offer these as commercial services

Last edited by Larsa on Sat Jan 28, 2023 7:18 pm, edited 1 time in total.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 7:11 pm

Since IPs used from youtube servers are not used only for youtube (no matter how fresh are the list),
you broke also other google service that broken other sites
(googleads, googleadservices, google-analytics, googlesyndication, googletagmanager, googletagservices, doubleclick, 1e101, etc.)
because often other sites that have nothig to do directly with google, use google services for dispaly contents and on this way are broken…..

holvoetn

Forum Guru
Forum Guru

Posts: 3817
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 7:12 pm

That’s the whole point of pi-hole … :?

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 7:15 pm

NO, still valid post #2:
Until you do not have full control of user device, you can not stop DoH & Co. with pihole (and neither the VPNs).

If someone want go to youtube, go to youtube.

User avatar
Larsa

Forum Veteran
Forum Veteran

Posts: 892
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa’s Workshop

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 7:25 pm

Many cruise ships and airlines block YouTube and similar streaming services by using specialized providers that offer these as commercial services (ie ip and dns blocking). And yes, there might be shared streaming services for some suppliers. Forget DPI.

User avatar
mozerd

Forum Veteran
Forum Veteran

Posts: 864
Joined: Thu Oct 05, 2017 3:39 pm
Location: Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 7:33 pm

DPI (Deep Packet Inspection) is currently impossible to perform on standard encrypted payloads which is what almost all traffic is these days, thus you have just IP address and port number to play with. Also, there is no hardware that can crack today’s encryption algorithms and decrypt traffic in real-time. It’s worth noticing that the most current algorithms are also quantum-safe.

@Larsa
I happen to disagree with your opinion … I have a number of very successful inexpensive CMS systems in service made by Untangle that are very effective as MY Clients continue tell me …. and recently I have seen the DrayTek models I referred to earlier that are doing well in this area reported by some of my Colleagues that have peeked my interest due to there performance metrics that are also relatively inexpensive when compared to the big boys CMS offerings …

User avatar
Larsa

Forum Veteran
Forum Veteran

Posts: 892
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa’s Workshop

Re: Block Youtube on computers and smartphone apps

Sat Jan 28, 2023 7:44 pm

They can certainly work to a limited extent using only IP addresses and port numbers, but there are no standard firewalls capable of running DPI on encrypted traffic. Any company with a reasonably updated understanding of security runs business-critical applications with encrypted communication, even for internal use.

reinerotto

Long time Member
Long time Member

Posts: 518
Joined: Thu Dec 04, 2008 2:35 am

Re: Block Youtube on computers and smartphone apps

Sun Jan 29, 2023 5:53 am

Until you do not have full control of user device, you can not stop DoH & Co. with pihole (and neither the VPNs).

Not absolutely correct. You _can_ stop DoH/DoT, and VPNs as well, at least, many or most of them.
I.e. for WiFi in schools, this is an important feature.
You can _not_ block DoH without DPI, in case the user is running his private DoH-server, or his private VPN-server.

User avatar
Jotne

Forum Guru
Forum Guru

Posts: 3221
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block Youtube on computers and smartphone apps

Sun Jan 29, 2023 12:05 pm

You can stop DoH/DoT, and VPNs as well, at least, many or most of them.

some of them. Since you can not see inside 443 encrypted packets, you have no way to see if it just normal https traffic or any VPN going over port 443.

As rextended writes, you need full control of the client to make sure you now what are going on.

—————————————————————————————-
Use Splunk> to log/monitor your MikroTik Router(s). See link below. :mrgreen:

MikroTik->Splunk

Last edited by Jotne on Sun Feb 12, 2023 9:50 pm, edited 1 time in total.

User avatar
jbl42

Member Candidate
Member Candidate

Posts: 200
Joined: Sun Jun 21, 2020 12:58 pm

Re: Block Youtube on computers and smartphone apps

Sun Jan 29, 2023 12:42 pm

As always with technical problems: It is not about who is right. It is about what works.

In summary:
Youtube can be blocked to a certain extend for the average user by forwarding DNS to a commercial DNS service like Cloudflare, Umbrella etc. They have the abilities to track and adapt to the constant changes on youtubes’s CDS host entries and filter them out. You cannot block the youtube CDS IPs in general, as they run many other services beside youtube on the same IPs.
You can block DoHS/HTTPS VPN for the average user by blocking 443 to IPs of the well known public accessible VPN and DoHS servers.

This mostly limits access for the average school student or hotel guest.
But there is no way to block someone with the necessary skills to use HTTPS VPN and/or DoHS to connect to a server IP you do not know about.
Except enterprise HTTPS proxy solutions breaking up the SSH connection, doing DPI and reencrypting towards the internal client using a private root Cert installed as trusted on the internal clients.

Everyone claiming different is invited to provide working solutions instead of just presenting assertions on what they think works or does not.
Because again: It is not about who is right. It is about what works.

reinerotto

Long time Member
Long time Member

Posts: 518
Joined: Thu Dec 04, 2008 2:35 am

Re: Block Youtube on computers and smartphone apps

Sun Jan 29, 2023 1:00 pm

Applaus.
You did the «teaching», I was too lazy for. Assuming, my hints would trigger some thinking.
BTW: SNI intercept can also help in blocking youtube etc.

User avatar
memelchenkov

Member Candidate
Member Candidate

Posts: 182
Joined: Sun Oct 11, 2020 12:00 pm
Contact:

Re: Block Youtube on computers and smartphone apps

Sun Jan 29, 2023 1:23 pm

BTW: SNI intercept can also help in blocking youtube etc.

TLS 1.3 encrypts SNI. So this method is gone now.

reinerotto

Long time Member
Long time Member

Posts: 518
Joined: Thu Dec 04, 2008 2:35 am

Re: Block Youtube on computers and smartphone apps

Sun Jan 29, 2023 1:59 pm

Actually, not enforced everywhere. Does youtube enforce it ?

User avatar
Jotne

Forum Guru
Forum Guru

Posts: 3221
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block Youtube on computers and smartphone apps

Sun Jan 29, 2023 6:13 pm

This mostly limits access for the average school student

This is the worst group. I have been working with network for high school student over many years, and they find away around everything. If one finds out all knows how to bypass blockage in just some seconds.

—————————————————————————————-
Use Splunk> to log/monitor your MikroTik Router(s). See link below. :mrgreen:

MikroTik->Splunk

Last edited by Jotne on Sun Feb 12, 2023 9:50 pm, edited 1 time in total.

jovaf32128

just joined

Posts: 24
Joined: Sun Apr 26, 2020 9:22 pm

Re: Block Youtube on computers and smartphone apps

Sun Jan 29, 2023 7:27 pm

«Voilà! shit», but have you tried it?
Browsers will still use https/TLS anyway,
it’s not that QUIC is the only thing that exists.

Yes. In my case I wanted to slow down youtube traffic, so used mangle with tls-host *googlevideo.com* to mark packets for the queues. But specially for you I tried to do:

add action=reject chain=forward protocol=tcp reject-with=tcp-reset tls-host=*googlevideo.com*

and it also works well. Yes, youtube.com still opened, but no one video was loaded.

User avatar
jbl42

Member Candidate
Member Candidate

Posts: 200
Joined: Sun Jun 21, 2020 12:58 pm

Re: Block Youtube on computers and smartphone apps

Mon Jan 30, 2023 12:52 am

Yes, using tls-host is in my experience the best result with least effort

add action=reject chain=forward in-interface-list=LAN protocol=tcp reject-with=tcp-reset tls-host=*.googlevideo.com

Plus a rule to block quic. It is resistant to DoHS, but not against VPN. It requires only one simple and easy to maintain filter rule.
Until you realize there are thousands of other video sites and streaming portals still working and requiring rules.
At the end it is a hare and hedgehog race with your users you hardly ever win.

User avatar
Znevna

Forum Guru
Forum Guru

Posts: 1352
Joined: Mon Sep 23, 2019 1:04 pm

Re: Block Youtube on computers and smartphone apps

Mon Jan 30, 2023 9:27 am

So you’re all responsible for all those complaints about youtube / facebook beeing slow or non functional, because you put crap limits on things.

User avatar
jbl42

Member Candidate
Member Candidate

Posts: 200
Joined: Sun Jun 21, 2020 12:58 pm

Re: Block Youtube on computers and smartphone apps

Wed Feb 01, 2023 10:24 pm

I’m not ;-)

I only apply such filters for stupid paying customers wanting it. Because they only know YouTube for video and Facebook for social media. So they think trying to block those two sites helps anything.
What I sometimes do on sites with low bandwidth uplink is using tls-host rules to apply youtube/netflix etc. (whatever their favorite video/streaming sites are) to low priority queues. So they can watch videos without having to fear disrupting ongoing Zoom/Teams/SIP calls.
But even for such use cases, I started to prefer Cake queues. Cake does priorisation automatically with mostly good results without requiring to maintain a set of tls-host rules for individual DNS hosts.

User avatar
ahmedramze

Member Candidate
Member Candidate

Posts: 107
Joined: Mon Feb 21, 2005 9:29 am
Location: IRAQ
Contact:

Re: Block Youtube on computers and smartphone apps

Thu Feb 02, 2023 12:20 am

Hi

blocking youtube will cos issues in some google services such as app/gmail/etc. they use same IPs and domains for google global cache and if you block it it will move your ip into next GGC node.
but you can burst queue for video like 2kbps for 5-10sec which make video in downloads loop.

google/Meta/Amazon CDNs they not one IP or range you can block it some videos stored in local GGC and other in another country.

if you need it urgently better talk with your ISP to block your Public IP from getting videos only but I don’t know if google accept to do it.

also Working on L7 filtering its but you on CPU load for mikrotik.

Regards.

dtaht

Member Candidate
Member Candidate

Posts: 199
Joined: Sat Aug 03, 2013 5:46 am

Re: Block Youtube on computers and smartphone apps

Fri Feb 10, 2023 10:21 pm

I’m not ;-)

I only apply such filters for stupid paying customers wanting it. Because they only know YouTube for video and Facebook for social media. So they think trying to block those two sites helps anything.
What I sometimes do on sites with low bandwidth uplink is using tls-host rules to apply youtube/netflix etc. (whatever their favorite video/streaming sites are) to low priority queues. So they can watch videos without having to fear disrupting ongoing Zoom/Teams/SIP calls.
But even for such use cases, I started to prefer Cake queues. Cake does priorisation automatically with mostly good results without requiring to maintain a set of tls-host rules for individual DNS hosts.

Yay! The point here (especially for ipv6 (Always) OR ipv4 on cake located on the nat router) is that it manages flows to hosts better. A host doing voip and one doing netflix and one doing torrent get balanced automatically, each getting 1/3 the bandwidth, and what you dont use gets shared equally, so voip experiences zero queuing delay, because it is lightweight.

I am not big on the word prioritization, what lies underneath is per host/per flow fq. https://arxiv.org/abs/1804.07617

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Sun Feb 12, 2023 9:54 pm

Do you say that you can stop me from browsing where I want without having 100% control of the client? PC/Mobil etc.
How do you block DoH/DoQ/DoT?

You turn it off in the clients.

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Sun Feb 12, 2023 9:58 pm

I tried every possible way I saw on the Internet but didn’t work with me, I would really appreciate your help.
Thanks in advance.

I accompished the goal by having some control on the clients and Pi-Hole..

Disabled DoH (DNS over HTTPS) and set Pi-Hole to block YouTube.

I also have 8.8.8.8 and 8.8.4.4 blocked so that the Application can’t try it’s own lookups.

User avatar
Jotne

Forum Guru
Forum Guru

Posts: 3221
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 8:36 am

Do you say that you can stop me from browsing where I want without having 100% control of the client? PC/Mobil etc.
How do you block DoH/DoQ/DoT?

You turn it off in the clients.

And this is what I say, to do that you need to have control of the clients, just as I did write above.
In a company network with company rules ok. As an IPS not.

————————————————————————————————
Use Splunk> to log/monitor your MikroTik Router(s).—> MikroTik->Splunk :mrgreen:
Backup config to Gmail —>Backup
Block users that tries too use non open ports —>Block

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 10:54 am

All this posts, but still valid what is written on post #2…
All is useless after that post, no matter what users writes…
viewtopic.php?t=188288#p950776

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 11:04 am

————————————————————————————————
Use Splunk> to log/monitor your MikroTik Router(s).—> MikroTik->Splunk :mrgreen:
Backup config to Gmail —>Backup
Block users that tries too use non open ports —>Block

————————————————————————————————
Use Splunk> to log/monitor your MikroTik Router(s).—> MikroTik->Splunk :mrgreen:
Backup config to Gmail —>Backup
Block users that tries too use non open ports —>Block

Please stop adding fake signatures, on the forum they are disabled on purpose, and adding this is spam, because users can’t block your text from being seen.

User avatar
Jotne

Forum Guru
Forum Guru

Posts: 3221
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 11:37 am

I will do.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 11:42 am

I will do.

Thank you for your courtesy. Really… thanks…

User avatar
nichky

Forum Guru
Forum Guru

Posts: 1218
Joined: Tue Jun 23, 2015 2:35 pm

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 11:55 am

from my experience , if u want to block https traffic defiantly MT can do perfectly, but if u want on application level, i found useful by using OpenDNS

User avatar
anav

Forum Guru
Forum Guru

Posts: 17447
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 2:21 pm

I will do.

If it was exquisite Italian Art, it may pass the rextended litmus test. :-)
So perhaps next time a naked David with half a prick ;-)

reinerotto

Long time Member
Long time Member

Posts: 518
Joined: Thu Dec 04, 2008 2:35 am

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 4:01 pm

All this posts, but still valid what is written on post #2…

Please, stop to spread wrong info. You can not assume, that, in case, you did not succeed in blocking, nobody else can do, as well.
I.e. what does any browser, trying to use QUIC, in case UDP port 443 blocked in router ?
There is an old proverb, in Chinese: Those, who do not know, talk. Those, who know, do not talk.

User avatar
anav

Forum Guru
Forum Guru

Posts: 17447
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 4:47 pm

An old North American Proverb, if you open your mouth any further, will be able to fit both feet in it !!

[ caveat: I know sheite about quic, quiddich etc. but I do like proverbs and the occasional reverb ]

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 5:23 pm

All this posts, but still valid what is written on post #2…
All is useless after that post, no matter what users writes…

What I wrote, does work.

My network, my rules.. Don’t like my rules, you’ll find your MAC address(es) blocked.

My AP already doesn’t allow ‘randomized MACs’ from connecting.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 6:04 pm

All this posts, but still valid what is written on post #2…

Please, stop to spread wrong info. You can not assume, that, in case, you did not succeed in blocking, nobody else can do, as well.
I.e. what does any browser, trying to use QUIC, in case UDP port 443 blocked in router ?
There is an old proverb, in Chinese: Those, who do not know, talk. Those, who know, do not talk.

Did you forget about the topic?
Please point me to the point where you explain exactly how: «Block Youtube on computers and smartphone apps» and we mean, youtube only, of course.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 6:06 pm

What I wrote, does work.

Is not correct, on post #2
supposed: no control on user devices

User avatar
Jotne

Forum Guru
Forum Guru

Posts: 3221
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 7:00 pm

And if some tries to block some, you can always use an external service.

This is not a commercial, since it free, but you get a free Oracle VPS with:
4 strong ARM CPU (aarc64)
24 GB ram
200GB disk
+ much more
Free for life

So I can setup a proxy server/vpn +++ for free and bypass the most.

I can set it up so when I do go to youtube.jotne.it than it opens youtube.com in my url. Cloudflare ZeroTrust (free for home users)

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 7:10 pm

What I wrote, does work.

Is not correct, on post #2
supposed: no control on user devices

You said in Post #2, that it isn’t possible..

It is..

If the client devices want internet access, they follow my rules (no VPNs and no DoH).. Internet traffic without DNS lookups, they get null-routed.

I have TikTok permanently blocked, sometimes YouTube.

The problem with blocking YouTube for students, is that some (many) teachers assign YouTube videos as instruction and/or homework.

User avatar
Jotne

Forum Guru
Forum Guru

Posts: 3221
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 7:13 pm

And this is with MikroTik Router?
Post your config.

User avatar
anav

Forum Guru
Forum Guru

Posts: 17447
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 7:15 pm

And this is with MikroTik Router?
Post your config.

What, you want evidence? Hearsay and opinion are not enough!

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 7:21 pm

And this is with MikroTik Router?
Post your config.

My AP (Cisco Aironet) has a checkbox to disallow ‘randomized’ MACs.

PiHole blocks TikTok and YouTube (when desired).

RouterOS drops 1.1.1.1, 8.8.4.4, and 8.8.8.8 and individual clients as needed. Plus a few other well-known DoH servers.

I look at the PiHole logs manually, if a client isn’t making lookups, I manually add them to the firewall drop rules.

Last edited by kevinds on Mon Feb 13, 2023 7:23 pm, edited 1 time in total.

User avatar
Jotne

Forum Guru
Forum Guru

Posts: 3221
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 7:22 pm

Evidens that some are done that I would say can not be down without control of the client.

Try this:
https://ultrasurf.us/

Its a simple exe file, that your run on your PC (or other), that makes a proxy for your browser. No need to admin rights.
Its made for passing the great wall of china.
And this is just one of many tools that can be used to bypass the most blockage.

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 7:25 pm

puTTY.exe can do this too with an SSH server.

My network, I would notice both (no DNS lookups for the host), and then drop the host’s traffic.

Last edited by kevinds on Tue Feb 14, 2023 4:34 am, edited 1 time in total.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 10:33 pm

So you block everything, not youtube selectively, and continue to be offtopic.

No one has posted a NON-invasive method on the client device, which selectively blocks youtube ONLY,
no matter if the user use VPN, private DoH (yes… PRIVATE…), ICMP tunnels, etc…

All empty talks…

Still valid post #2, that is the reply of this topic, not about change client device config or block everything if the user do not use that DNS, etc.

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 10:48 pm

So you block everything, not youtube selectively, and continue to be offtopic.

No.

I *only* block everything if the host continues to use DoH and/or VPN/Proxy services.

No one has posted a NON-invasive method on the client device, which selectively blocks youtube ONLY,
no matter if the user use VPN, private DoH (yes… PRIVATE…), ICMP tunnels, etc…

If a LAN IP has internet traffic but no local DNS lookups, they lose internet access.

What does non-invasive mean to you?

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 11:10 pm

What does non-invasive mean to you?

It’s invasive to block everything in retaliation because you are not able to just block youtube…

It is invasive to act on the customer’s device.

The customer must be able to do anything freely, except use youtube, and you must not touch the device config or install some software.
If you alter this premise in anything, is not anymore on topic.
It’s obvious if I break the client device, with that he doesn’t go on youtube anymore… (but not anywhere else either…)

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 11:19 pm

How is this not on topic? That wasn’t a stated requirement in the OP.

Otherwise you are being dumb.. User is allowed whatever proxy and VPN they want, but still ‘required’ to block YouTube? No solution can do that unless internet access overall is white-listed.

My network, my rules. If the user wants internet access, they are not allowed to use VPN/Proxy or DoH. They use those, they lose network access. User can do it themselves or they can ask for help with the settings if they need.

Last edited by kevinds on Tue Feb 14, 2023 4:35 am, edited 1 time in total.

User avatar
rextended

Forum Guru
Forum Guru

Posts: 11516
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 11:31 pm

Post #2….

No solution can do that unless internet access overall is white-listed.

they are not allowed to use VPN/Proxy or DoH. They use those, they lose network access

Too bad we are not close, otherwise I would show you how easy it is to get around this thing…
Of course, if you know I’m there and you purposely watch what I do…
But try to catch me with hundreds of other people surfing on the same network…
As long as you don’t blacklist EVERYTHING and only allow certain IPs/sites, there is always a way around the blocks.

User avatar
anav

Forum Guru
Forum Guru

Posts: 17447
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 11:47 pm

There is always a way to skin the cat so to speak :-)

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Mon Feb 13, 2023 11:50 pm

As long as you don’t blacklist EVERYTHING and only allow certain IPs/sites, there is always a way around the blocks.

Everything can be gotten around with time and effort.. My primary method is to remove users with traffic that do not have DNS lookups, which would work for the OP and majority of users.

Blocking YouTube for students, is not a good idea because teachers assign/use YouTube for lessons, but it can be done. I will have TikTok blocked for the foreseeable future though.

Last edited by kevinds on Tue Feb 14, 2023 4:36 am, edited 1 time in total.

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Tue Feb 14, 2023 12:03 am

As long as you don’t blacklist EVERYTHING and only allow certain IPs/sites, there is always a way around the blocks.

Even that can be gotten around, speaking from experience.. haha Time and effort.. ;)

User avatar
anav

Forum Guru
Forum Guru

Posts: 17447
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Tue Feb 14, 2023 12:17 am

…. I will have TikTok blocked for the foreseeable future though.

Haha, really showing your age, family members will use cell data to watch tik tok as the main vector is smartphone… Get with the times Kev! ;-)
By the way tik tok also makes large balloons! :-)

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Tue Feb 14, 2023 12:32 am

They tried that when I blocked YouTube…

I turned off their cellular data in response.. ;)

Last edited by BartoszP on Tue Feb 14, 2023 2:51 am, edited 1 time in total.

Reason: removed excessive quotting of preceding post; be wise, quote smart, save network traffic

User avatar
anav

Forum Guru
Forum Guru

Posts: 17447
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Tue Feb 14, 2023 1:21 am

Well, the outcome will be quite simple, they will either
a. spend less and less time at your place ( the dungeon) and more and more time at other peoples houses. :-0
b. will become software and wifi engineers and devise work arounds ( heck a wireless wire cube setup in the right location would allow them to beam and bypass your entire setup LOL )

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Tue Feb 14, 2023 1:30 am

I will encourage both options.. Especially «b». :D

Already have a longer-term goal of talking to the ISS as it passes over..

Likely less effort to hack the Pi-Hole server and disable the custom domain blacklists..

Quick/dirty solution to «b» would be deauths though.. ;)

BOFH, I am well aware, but it works well.. haha

Last edited by kevinds on Tue Feb 14, 2023 6:04 am, edited 2 times in total.

User avatar
anav

Forum Guru
Forum Guru

Posts: 17447
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Block Youtube on computers and smartphone apps

Tue Feb 14, 2023 1:41 am

I wonder if they will go into the drywall and splice off the ethernet line heading to your computer………oh the malware they could inject………

kevinds

Member
Member

Posts: 447
Joined: Wed Jan 14, 2015 8:41 am

Re: Block Youtube on computers and smartphone apps

Tue Feb 14, 2023 1:50 am

I did that at my parent’s place when I was younger.. haha Telephone line though, for dialup..

Last edited by BartoszP on Tue Feb 14, 2023 2:51 am, edited 1 time in total.

Reason: removed excessive quotting of preceding post; be wise, quote smart, save network traffic

Display posts from previous:
Sort by

mt1974

Сообщения: 4
Зарегистрирован: 11 сен 2018, 10:05

Всем привет,
Приобрел себе RB2011UiAS-IN. Основная цель — фильтрация детского траффика.
Попробовал заблокировать youtube следующим образом:

/ip firewall layer7-protocol
add name=youtube regexp=»^.+(youtube).*$»

/ip firewall mangle
add action=mark-connection chain=prerouting protocol=udp dst-port=53 connection-mark=no-mark layer7-protocol=youtube new-connection-mark=youtube_conn assthrough=yes
add action=mark-packet chain=prerouting connection-mark=youtube_conn new-packet-mark=youtube_packet

/ip firewall filter
add action=drop chain=forward packet-mark=youtube_packet
add action=drop chain=input packet-mark=youtube_packet

После чего сдвинул правила почти на самый верх. Но ничего не получилось — youtube доступен.

Если не сложно, подскажите пожалуйста в чем я ошибся!

ДТ

mt1974

Сообщения: 4
Зарегистрирован: 11 сен 2018, 10:05

11 сен 2018, 11:33

Пробовал примерно так:

/ip firewall address-list add list=BlockedSites address=youtube.com disabled=no
/ip firewall filter add chain=forward src-address-list=BlockedSites protocol=tcp action=reject reject-with=tcp-reset comment=»BlockedSites» disabled=no

Почему то тоже мимо кассы (

KARaS’b

Сообщения: 1199
Зарегистрирован: 29 сен 2011, 09:16

11 сен 2018, 11:47

Добавьте еще www.youtube.com и правило фаервола в самый вверх для проверки. Проверял «на своей шкуре», все отрабатывает 100%.
Не забывайте, фаервол блокирует новые соединения, если соединение уже установлено, то оно продолжит работать, поэтому как минимум во время проверки закрывайте браузер перед изменениями конфигурации, что бы закрылись соединения.

KARaS’b

Сообщения: 1199
Зарегистрирован: 29 сен 2011, 09:16

11 сен 2018, 12:16

И я сразу не увидел, у вас ошибка в правиле фаервола, надо блокировать dst-address-list, а не src-address-list и протокол указывать не обязательно, так будут блокироваться все типы соединения.

Аватара пользователя

podarok66

Модератор
Сообщения: 4281
Зарегистрирован: 11 фев 2012, 18:49
Откуда: МО

11 сен 2018, 22:14

Да он и верхний способ должен работать, просто перед проверкой надо соединения все сбрасывать, там же метит только новые, а все уже установленные и дочерние будут разрешены до сброса)))

Мануалы изучил и нигде не ошибся? Фаервол отключил? Очереди погасил? Витая пара проверена? … Тогда Netinstal’ом железку прошей и настрой ее заново. Что, все равно не фурычит? Тогда к нам. Если не подскажем, хоть посочувствуем…

vbsev

Сообщения: 84
Зарегистрирован: 19 авг 2018, 09:35

13 сен 2018, 17:38

можно еще добавить в микротике маршрут на ютуб, где в качестве шлюза будет ip локалки. Дальше роутера ничего не уйдёт.

Аватара пользователя

podarok66

Модератор
Сообщения: 4281
Зарегистрирован: 11 фев 2012, 18:49
Откуда: МО

13 сен 2018, 20:34

vbsev писал(а): ↑

13 сен 2018, 17:38


можно еще добавить в микротике маршрут на ютуб, где в качестве шлюза будет ip локалки. Дальше роутера ничего не уйдёт.

Это-то еще зачем, если и так дропнули соединение? Не стоит совершать лишние телодвижения с тем, чтобы потом при какой-то мелкой проблеме копаться в куче лишнего кода. Оптимизация — наше всё.

Мануалы изучил и нигде не ошибся? Фаервол отключил? Очереди погасил? Витая пара проверена? … Тогда Netinstal’ом железку прошей и настрой ее заново. Что, все равно не фурычит? Тогда к нам. Если не подскажем, хоть посочувствуем…

  • Как заблокировать youtube на роутере asus
  • Как заблокировать skype на роутере
  • Как заблокировать mac адрес на роутере tp link
  • Как заблокировать youtube канал на роутере
  • Как заблокировать wot blitz на роутере