Steps 1: First of all we create a address list of local ip lan in IP Firewall Address List in Mikrotik Firewall or Router.
Similar way, we can use address list IP-Facebook in all raw rule for .facebook.net, .fbcdn.net, .fbsbx.com, .fb.com, .fb.gg, .messenger.com.
Now we can create a Firewall raw rule for domain .facebook.com.
Then, in Raw advance tab, select IP-LAN address list which we have create earlier in src and dst address list as like as screenshot and select not ! sign in dst. address list. And in content option write .facebook.com similarly for .facebook.net, .fbcdn.net, .fbsbx.com, .fb.com, .fb.gg, .messenger.com.
Then in
action tab, we can select add dst to address list and in Address list
we can give the name of address list which i have used IP Facebook then OK. New
Firewall Raw rule has created for domain .facebook.com. Similarly we can make
new Raw rule for .facebook.net, .fbcdn.net, .fbsbx.com, .fb.com, .fb.gg,
.messenger.com.
Similarly for facebook.net.
Now if someone from LAN user browse facebook.com we will see ip dynamically assign in IP Facebook list. we can check it from Firewall Address list.
Now we can make a firewall filter rule and apply the rule for IP Facebook address list to block facebook site from LAN network.
In Mikrotik Firewall option we can select forward chain and select address list IP Facebook and finally action will be drop.
Select forward chain general tab.
Then select IP Facebook in dst. Address List in advance tab.
Finally, select drop in Action in Action tab an then click OK.Then a firewall filter rule can add in firewall filters and start to block all facebook access from LAN.
Now all facebook access attempt should be block.
Note: If required to access facebook from a perticular IPs, first create a new address list and keep those users ips in new address list then create another firewall rules which will be forwarding chain, in advance tab src address list will be new permitted ip address list and dst. address list will be IP Facebook and finally action will be accept and remember this rule will be before your drop rule.
By using same process, we can block youtube, tiktok, twitter and any other site from Mikrotik firewall.
In Command:
For Facebook:
/ip firewall raw
add action=add-dst-to-address-list address-list="IP Facebook" \
address-list-timeout=none-dynamic chain=prerouting comment=Facebook \
content=.facebook.com dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list="IP Facebook" \
address-list-timeout=none-dynamic chain=prerouting comment=Fecebook \
content=fb.com dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list="IP Facebook" \
address-list-timeout=none-dynamic chain=prerouting comment=Fecebook \
content=.cdninstagram.com dst-address-list=!IP-LAN src-address-list=\
IP-LAN
add action=add-dst-to-address-list address-list="IP Facebook" \
address-list-timeout=none-dynamic chain=prerouting comment=Fecebook \
content=.facebook.net dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list="IP Facebook" \
address-list-timeout=none-dynamic chain=prerouting comment=Fecebook \
content=.instagram.com dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list="IP Facebook" \
address-list-timeout=none-dynamic chain=prerouting comment=Fecebook \
content=messenger.com dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list="IP Facebook" \
address-list-timeout=none-dynamic chain=prerouting comment=Fecebook \
content=fb.gg dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list="IP Facebook" \
address-list-timeout=none-dynamic chain=prerouting comment=Fecebook \
content=.fbsbx.com dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list="IP Facebook" \
address-list-timeout=none-dynamic chain=prerouting comment=Fecebook \
content=.fbcdn.net dst-address-list=!IP-LAN src-address-list=IP-LAN
For Youtube:
/ip firewall raw
add action=add-dst-to-address-list address-list=IP-Youtube \
address-list-timeout=none-dynamic chain=prerouting comment="IP Youtube" \
content=.youtube.com dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list=IP-Youtube \
address-list-timeout=none-dynamic chain=prerouting comment="IP Youtube" \
content=.googlevideo.com dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list=IP-Youtube \
address-list-timeout=none-dynamic chain=prerouting comment="IP Youtube" \
content=.youtu.be dst-address-list=!IP-LAN src-address-list=IP-LAN
add action=add-dst-to-address-list address-list=IP-Youtube \
address-list-timeout=none-dynamic chain=prerouting comment="IP Youtube" \
content=.ytimg.com dst-address-list=!IP-LAN src-address-list=IP-LAN
For Facebook and Youtube:
/ip firewall filter
add action=accept chain=forward comment="Facebook Permit through IP" \
disabled=yes dst-address-list="IP Facebook" src-address-list=Access-FB
add action=drop chain=forward comment="Facebook Block Through IP" \
dst-address-list="IP Facebook"
add action=drop chain=forward comment="Youtube Block Through IP" \
dst-address-list=IP-Youtube
Thanks and Happy Learning
Hi, can you explaine ...Steps 1: First of all we create a address list of local ip lan in IP Firewall Address List in Mikrotik Firewall or Router.;
ReplyDeleteis done when there are several lan?