Block Youtube on computers and smartphone apps

I can block traffic youtube from smartphone and laptop using this script. after try many more

**#add L7 regex
/ip firewall layer7-protocol
add name=YT-BLK regexp="^.+(.youtube.com|.ytimg.com|.googlevideo.com).$"

#add dynamic address list when matches with l7 regex
/ip firewall mangle
add action=add-dst-to-address-list address-list=YT-BLK address-list-timeout=none-dynamic chain=forward layer7-protocol=YT-BLK

#block ip dst youtube
/ip firewall filter
add action=drop chain=forward connection-state=“” dst-address-list=YT-BLK out-interface=ether1-WAN

you can try and command at this if success or not.

thanks

If I have control over my device connected to your network, i just connect to the https based VPN server running on one of my servers.
For your firewall it is just encrypted https traffic on usual dest port 443. For me it is a tunnel to my server from where I can go everywhere. Including youtube.

Mancava questo invio alla collezione…

/ip firewall filter
add action=add-dst-to-address-list address-list="Youtube Block" \
    address-list-timeout=4d chain=forward dst-port=443 protocol=tcp tls-host=\
    *youtube*
add action=drop chain=forward dst-address-list="Youtube Block" src-address=\
    192.168.88.0/24

This works for me, blocks YouTube app for Android/iOS, smart TV and PC browsers.
Fasttrack must be deactivated.

It also works with RAW

/ip firewall raw
add action=add-dst-to-address-list address-list="Youtube Block" \
    address-list-timeout=3d chain=prerouting dst-port=443 protocol=tcp \
    tls-host=*youtube*
add action=drop chain=prerouting dst-address-list="Youtube Block"

I don’t know which is lighter for the CPU (Filter or RAW).

It will work until Youtube hosts implements ESNI. After that you can only block by address list with resolved Youtube hosts and hoping that some of that resolved Youtube host IPs are not shared with some other hosts that are on same IP that shouldn’t be blocked (some Google service for eg.).
There are also sites like this or this which are for downloading/watching videos related to some session on website or as helper for mobile browsers which doesn’t have video download addons, on this sites it is possible to watch/download YT videos if you get link from elsewhere (when YT domain is blocked), in this case direct YT video is requested in browser from URL at googlevideo.com domain (because site backend side is parsing YT page to get video URL and it’s not requested from browser) and it should be also blocked if you want to avoid that. Maybe there are also sites what are warping YT over their domain too using YT API key for fetching and playing videos (probably paid service since free YT API key has limits).

You’re right, I read that this kind of traffic can’t be analyzed even with a DPI firewall.
Let’s see what will happen later…