Block any web site in L7 except one

This is my configuration on RouterOS:

/ip firewall layer7-protocol
add name=Yahoo regexp="^.*(yahoo).*\$"



/ip firewall filter
add action=drop chain=forward layer7-protocol=Yahoo src-mac-address=\
    F0:E7:7E:54:57:2E

This will block the yahoo url properly, but when i’m using “not” (“!”) to block anything except yahoo:

/ip firewall filter
add action=drop chain=forward layer7-protocol=!Yahoo src-mac-address=\
    F0:E7:7E:54:57:2E

It won’t work! it will block all urls and yahoo! why? :open_mouth:

Hello cybercoder,

please have a look here inside and please read the second comment from cbrown, please.

Layer 7 facebook block
Perhaps it matches also in your case better!

Thanks for your attention, but i didn’t ask how block yahoo, i asked why it not works (“Not (”!“)” of a L7 Rule)

of-course it will block with IP address blockage! It will use firewall in IP layer! or i know how to except in the regex string without using logical NOT in filter Rule.
:slight_smile: