You are on page 1of 2

/ip firewall layer7-protocol

add name=torrentsites regexp="^.*(get|GET).+(torrent|thepiratebay|isohunt|


entertane|demonoid|btjunkie|mininova|flixflux|torrentz|vertor|h33t|btscene|
bitunity|bittoxic|thunderbytes|entertane|zoozle|vcdq|bitnova|bitsoup|meganova|
fulldls|btbot|flixflux|seedpeer|fenopy|gpirate|commonbits).*\$"

/ip firewall filter

add chain=forward src-address=192.168.15.0/24 layer7-protocol=torrentsites


action=drop comment=torrentsites
add chain=forward src-address=192.168.15.0/24 protocol=17 dst-port=53 layer7-
protocol=torrentsites action=drop comment=dropDNS
add chain=forward src-address=192.168.15.0/24 content=torrent action=drop
comment=keyword_drop
add chain=forward src-address=192.168.15.0/24 content=tracker action=drop
comment=trackers_drop
add chain=forward src-address=192.168.15.0/24 content=getpeers action=drop
comment=get_peers_drop
add chain=forward src-address=192.168.15.0/24 content=info_hash action=drop
comment=info_hash_drop
add chain=forward src-address=192.168.15.0/24 content=announce_peers action=drop
comment=announce_peers_drop

add chain=forward src-address=192.168.15.0/24 p2p=all-p2p action=drop


comment=p2p_drop

1. Login to your mikrotik device.(basic connectivity already been configured for


internet access)

2. Test before configuration

3. Click on new terminal


& copy-paste below script to create regexp in IP/Firewall/Layer 7 protocol
/ip firewall layer7-protocol
add comment=Block Torrents name=block-torrents regexp=^(\\x13bitt\
orrent protocol|azver\\x01\$|get /scrape\\\?info_hash=get /announce\\\?inf\
o_hash=|get /client/bitcomet/|GET /data\\\?fid=)|d1:ad2:id20:|\\x087P\\)[\
RP]

4. Copy & paste below script to create filter rule in IP/Firewall/Filter Rules
(change src-address=YOUR LOCAL SUBNET)
/ip firewall filter
add action=add-src-to-address-list address-list=Torrent-Conn \
address-list-timeout=2m chain=forward layer7-protocol=\
block-torrents src-address=192.168.1.0/24 src-address-list=\
!allow-bit
add action=add-src-to-address-list address-list=Torrent-Conn \
address-list-timeout=2m chain=forward p2p=all-p2p src-address=\
192.168.1.0/24 src-address-list=!allow-bit

5. Copy & paste below script to create filter rule in IP/Firewall/Filter Rules
(Most common ports use by torrent)
/ip firewall filter
add action=drop chain=forward dst-port=!0-1024,8291,5900,5800,3389,14147,5222,59905
protocol=tcp \
src-address-list=Torrent-Conn
add action=drop chain=forward dst-port=!0-1024,8291,5900,5800,3389,14147,5222,59905
protocol=udp \
src-address-list=Torrent-Conn

6. Test after configuration

7. Watch video tutorial below & dont forget to SUBSCRIBE for new updates.

You might also like