Is there any way I can mark traffic for youtube ?
(so that i can route it to second gateway)
I saw few posts on forum as well but most guys telling that not working. any working solution for it?
/ip firewall layer7-protocol add name=youtube regexp="^.+(youtube.com).*$"
/ip firewall filter add chain=forward protocol=tcp dst-port=80,443 layer7-protocol=youtube action=drop comment="Block YouTube"
its giving following errorTry this:
.Code: Select all/ip firewall layer7-protocol add name=youtube regexp="^.+(youtube.com).*$" /ip firewall filter add chain=forward protocol=tcp dst-port=80,443 layer7-protocol=youtube action=drop comment="Block YouTube"
/ip firewall layer7-protocol
add name=VIDEO-L7 regexp="^.*(youtube.com).*\\\$"
/interface bridge settings
set use-ip-firewall=yes
/ip firewall address-list
add address=208.117.224.0/24 list=youtube
add address=208.117.225.0/24 list=youtube
add address=208.117.228.0/24 list=youtube
add address=208.117.229.0/24 list=youtube
add address=208.117.232.0/24 list=youtube
add address=208.117.233.0/24 list=youtube
add address=208.117.234.0/24 list=youtube
add address=208.117.238.0/24 list=youtube
add address=208.65.152.0/24 list=youtube
add address=208.65.153.0/24 list=youtube
add address=208.65.154.0/24 list=youtube
add address=64.15.112.0/20 list=youtube
add address=208.117.236.0/24 list=youtube
add address=74.125.96.0/19 list=youtube
add address=72.14.221.0/24 list=youtube
/ip firewall layer7-protocol
add name=youtube regexp="^.*(youtube\\.com|googlevideo\\.com).*\$"
/ip firewall mangle
add action=add-dst-to-address-list address-list=youtube address-list-timeout=30m chain=prerouting layer7-protocol=youtube protocol=tcp
/ip firewall mangle
add action=mark-connection chain=forward connection-state=new dst-address-list=youtube dst-port=80 new-connection-mark=youtube passthrough=yes protocol=tcp
add action=mark-connection chain=forward connection-state=new dst-address-list=youtube dst-port=443 new-connection-mark=youtube passthrough=yes protocol=tcp
add action=mark-packet chain=forward connection-mark=youtube new-packet-mark=youtube passthrough=no
/ip firewall mangle
add action=mark-connection chain=forward dst-address-list=youtube dst-port=443 new-connection-mark=youtube passthrough=yes protocol=udp
add action=mark-connection chain=forward connection-state=new dst-address-list=youtube dst-port=80 new-connection-mark=youtube passthrough=yes protocol=tcp
add action=mark-connection chain=forward connection-state=new dst-address-list=youtube dst-port=443 new-connection-mark=youtube passthrough=yes protocol=tcp
add action=mark-packet chain=forward connection-mark=youtube new-packet-mark=youtube passthrough=no
Very good. Thanks Man.I'm not sure if it's still needed now, in 2017, but this is my solution, which I was developing for several days to make everything work nicely.
First, switch on the IP firewall:Then, add some YouTube networks to a new access list (just some you're sure belong to YouTube):Code: Select all/interface bridge settings set use-ip-firewall=yes
Add layer-7 protocol to determine YouTube traffic:Code: Select all/ip firewall address-list add address=208.117.224.0/24 list=youtube add address=208.117.225.0/24 list=youtube add address=208.117.228.0/24 list=youtube add address=208.117.229.0/24 list=youtube add address=208.117.232.0/24 list=youtube add address=208.117.233.0/24 list=youtube add address=208.117.234.0/24 list=youtube add address=208.117.238.0/24 list=youtube add address=208.65.152.0/24 list=youtube add address=208.65.153.0/24 list=youtube add address=208.65.154.0/24 list=youtube add address=64.15.112.0/20 list=youtube add address=208.117.236.0/24 list=youtube add address=74.125.96.0/19 list=youtube add address=72.14.221.0/24 list=youtube
Add mangle rule to add found IP addresses of YouTube to address-list (with timeout of 30 mins):Code: Select all/ip firewall layer7-protocol add name=youtube regexp="^.*(youtube\\.com|googlevideo\\.com).*\$"
Add mangle rule to mark YouTube traffic at last. The first rule marks a connection to youtube and then all the packets inside the connection are marked:Code: Select all/ip firewall mangle add action=add-dst-to-address-list address-list=youtube address-list-timeout=30m chain=prerouting layer7-protocol=youtube protocol=tcp
Viola! All the Youtube traffic is now marked.Code: Select all/ip firewall mangle add action=mark-connection chain=forward connection-state=new dst-address-list=youtube dst-port=80 new-connection-mark=youtube passthrough=yes protocol=tcp add action=mark-connection chain=forward connection-state=new dst-address-list=youtube dst-port=443 new-connection-mark=youtube passthrough=yes protocol=tcp add action=mark-packet chain=forward connection-mark=youtube new-packet-mark=youtube passthrough=no