Monday, 24 July 2017

MIKROTIK:How to Give more speed to Google Peering in your Mikrotik router or mikrotik NAS

Lets assume that i have the google peering and i want to give 20mbps for each users .

Here i am giving you the script to finish  the configuration in  3-4  to steps .



Lets starts the configuration .


step-1

Add all the Google IP address in your IP>Firewall>Address list 


/ip firewall address-list
add address=8.8.4.0/24 list=Google_IP
add address=8.8.8.0/24 list=Google_IP
add address=8.34.208.0/21 list=Google_IP
add address=8.34.216.0/21 list=Google_IP
add address=8.35.192.0/21 list=Google_IP
add address=8.35.200.0/21 list=Google_IP
add address=23.236.48.0/20 list=Google_IP
add address=23.251.128.0/19 list=Google_IP
add address=35.184.0.0/13 list=Google_IP
add address=35.192.0.0/13 list=Google_IP
add address=35.200.0.0/14 list=Google_IP
add address=35.204.0.0/15 list=Google_IP
add address=64.9.224.0/24 list=Google_IP
add address=64.9.225.0/24 list=Google_IP
add address=64.9.228.0/23 list=Google_IP
add address=64.15.112.0/20 list=Google_IP
add address=64.15.114.0/24 list=Google_IP
add address=64.15.122.0/24 list=Google_IP
add address=64.15.123.0/24 list=Google_IP
add address=64.233.160.0/19 list=Google_IP
add address=64.233.160.0/24 list=Google_IP
add address=64.233.161.0/24 list=Google_IP
add address=64.233.162.0/24 list=Google_IP
add address=64.233.163.0/24 list=Google_IP
add address=64.233.164.0/24 list=Google_IP
add address=64.233.165.0/24 list=Google_IP
add address=64.233.166.0/24 list=Google_IP
add address=64.233.167.0/24 list=Google_IP
add address=64.233.168.0/24 list=Google_IP
add address=64.233.169.0/24 list=Google_IP
add address=64.233.171.0/24 list=Google_IP
add address=64.233.176.0/24 list=Google_IP
add address=64.233.177.0/24 list=Google_IP
add address=64.233.178.0/24 list=Google_IP
add address=64.233.179.0/24 list=Google_IP
add address=64.233.180.0/24 list=Google_IP
add address=64.233.181.0/24 list=Google_IP
add address=64.233.182.0/24 list=Google_IP
add address=64.233.183.0/24 list=Google_IP
add address=64.233.184.0/24 list=Google_IP
add address=64.233.185.0/24 list=Google_IP
add address=64.233.186.0/24 list=Google_IP
add address=64.233.187.0/24 list=Google_IP
add address=64.233.188.0/24 list=Google_IP
add address=64.233.189.0/24 list=Google_IP
add address=64.233.190.0/24 list=Google_IP
add address=64.233.191.0/24 list=Google_IP
add address=66.102.0.0/20 list=Google_IP
add address=66.102.1.0/24 list=Google_IP
add address=66.102.2.0/24 list=Google_IP
add address=66.102.3.0/24 list=Google_IP
add address=66.102.4.0/24 list=Google_IP
add address=66.102.12.0/24 list=Google_IP
add address=66.249.64.0/19 list=Google_IP
add address=70.32.128.0/19 list=Google_IP
add address=70.32.128.0/23  list=Google_IP
add address=70.32.131.0/24 list=Google_IP
add address=70.32.134.0/24 list=Google_IP
add address=70.32.135.0/24 list=Google_IP
add address=70.32.140.0/23  list=Google_IP
add address=70.32.142.0/23  list=Google_IP
add address=70.32.145.0/24  list=Google_IP
add address=70.32.146.0/23  list=Google_IP
add address=70.32.151.0/24  list=Google_IP
add address=72.14.192.0/18  list=Google_IP
add address=74.114.24.0/21  list=Google_IP
add address=74.125.0.0/16   list=Google_IP
add address=74.125.0.0/18   list=Google_IP
add address=74.125.6.0/24   list=Google_IP
add address=74.125.21.0/24  list=Google_IP
add address=74.125.22.0/24  list=Google_IP
add address=74.125.23.0/24  list=Google_IP
add address=74.125.24.0/24  list=Google_IP
add address=74.125.26.0/24  list=Google_IP
add address=74.125.27.0/24  list=Google_IP
add address=74.125.28.0/24  list=Google_IP
add address=74.125.29.0/24  list=Google_IP
add address=74.125.30.0/24  list=Google_IP
add address=74.125.31.0/24  list=Google_IP
add address=74.125.39.0/24  list=Google_IP
add address=74.125.68.0/24  list=Google_IP
add address=74.125.69.0/24  list=Google_IP
add address=74.125.70.0/24  list=Google_IP
add address=74.125.71.0/24  list=Google_IP
add address=74.125.126.0/24 list=Google_IP
add address=74.125.127.0/24 list=Google_IP
add address=74.125.128.0/24 list=Google_IP
add address=74.125.129.0/24 list=Google_IP
add address=74.125.130.0/24 list=Google_IP
add address=74.125.131.0/24 list=Google_IP
add address=74.125.132.0/24 list=Google_IP
add address=74.125.133.0/24 list=Google_IP
add address=74.125.134.0/24 list=Google_IP
add address=74.125.135.0/24 list=Google_IP
add address=74.125.138.0/24 list=Google_IP
add address=74.125.139.0/24 list=Google_IP
add address=74.125.140.0/24 list=Google_IP
add address=74.125.141.0/24 list=Google_IP
add address=74.125.142.0/24 list=Google_IP
add address=74.125.143.0/24 list=Google_IP
add address=74.125.192.0/24 list=Google_IP
add address=74.125.193.0/24 list=Google_IP
add address=74.125.195.0/24 list=Google_IP
add address=74.125.196.0/24 list=Google_IP
add address=74.125.198.0/24 list=Google_IP
add address=74.125.199.0/24 list=Google_IP
add address=74.125.200.0/24 list=Google_IP
add address=74.125.201.0/24 list=Google_IP
add address=74.125.202.0/24 list=Google_IP
add address=74.125.203.0/24 list=Google_IP
add address=74.125.204.0/24 list=Google_IP
add address=74.125.205.0/24 list=Google_IP
add address=74.125.206.0/24 list=Google_IP
add address=74.125.225.0/24 list=Google_IP
add address=74.125.226.0/24 list=Google_IP
add address=74.125.227.0/24 list=Google_IP
add address=74.125.228.0/24 list=Google_IP
add address=74.125.230.0/24 list=Google_IP
add address=74.125.232.0/24 list=Google_IP
add address=74.125.234.0/24 list=Google_IP
add address=74.125.235.0/24 list=Google_IP
add address=74.125.236.0/24 list=Google_IP
add address=74.125.238.0/24 list=Google_IP
add address=89.207.224.0/24 list=Google_IP
add address=104.132.0.0/14  list=Google_IP
add address=104.132.0.0/23  list=Google_IP
add address=104.132.3.0/24  list=Google_IP
add address=104.132.5.0/24  list=Google_IP
add address=104.132.6.0/24  list=Google_IP
add address=104.132.7.0/24  list=Google_IP
add address=104.132.8.0/24  list=Google_IP
add address=104.132.11.0/24 list=Google_IP
add address=104.132.12.0/24 list=Google_IP
add address=104.132.18.0/24 list=Google_IP
add address=104.132.19.0/24 list=Google_IP
add address=104.132.25.0/24 list=Google_IP
add address=104.132.26.0/24 list=Google_IP
add address=104.132.29.0/24 list=Google_IP
add address=104.132.33.0/24 list=Google_IP
add address=104.132.34.0/24 list=Google_IP
add address=104.132.37.0/24 list=Google_IP
add address=104.132.38.0/24 list=Google_IP
add address=104.132.40.0/24 list=Google_IP
add address=104.132.41.0/24 list=Google_IP
add address=104.132.42.0/24 list=Google_IP
add address=104.132.43.0/24 list=Google_IP
add address=104.132.51.0/24 list=Google_IP
add address=104.132.56.0/24 list=Google_IP
add address=104.132.57.0/24 list=Google_IP
add address=104.132.59.0/24 list=Google_IP
add address=104.132.61.0/24 list=Google_IP
add address=104.132.62.0/24 list=Google_IP
add address=104.132.69.0/24 list=Google_IP
add address=104.132.113.0/24 list=Google_IP
add address=104.132.114.0/24 list=Google_IP
add address=104.132.116.0/24 list=Google_IP
add address=104.132.117.0/24 list=Google_IP
add address=104.132.118.0/24 list=Google_IP
add address=104.132.119.0/24 list=Google_IP
add address=104.132.120.0/24 list=Google_IP
add address=104.132.124.0/24 list=Google_IP
add address=104.132.125.0/24 list=Google_IP
add address=104.132.126.0/24 list=Google_IP
add address=104.132.128.0/24 list=Google_IP
add address=104.132.130.0/24 list=Google_IP
add address=104.132.132.0/24 list=Google_IP
add address=104.132.135.0/24 list=Google_IP
add address=104.132.136.0/24 list=Google_IP
add address=104.132.138.0/24 list=Google_IP
add address=104.132.140.0/24 list=Google_IP
add address=104.132.141.0/24 list=Google_IP
add address=104.132.144.0/24 list=Google_IP
add address=104.132.146.0/24 list=Google_IP
add address=104.132.149.0/24 list=Google_IP
add address=104.132.150.0/24 list=Google_IP
add address=104.132.151.0/24 list=Google_IP
add address=104.132.152.0/24 list=Google_IP
add address=104.132.153.0/24 list=Google_IP
add address=104.132.155.0/24 list=Google_IP
add address=104.132.159.0/24 list=Google_IP
add address=104.132.161.0/24 list=Google_IP
add address=104.132.162.0/24 list=Google_IP
add address=104.132.164.0/24 list=Google_IP
add address=104.132.165.0/24 list=Google_IP
add address=104.132.166.0/24 list=Google_IP
add address=104.132.169.0/24 list=Google_IP
add address=104.132.177.0/24 list=Google_IP
add address=104.132.179.0/24 list=Google_IP
add address=104.132.180.0/24 list=Google_IP
add address=104.132.183.0/24 list=Google_IP
add address=104.132.184.0/24 list=Google_IP
add address=104.132.186.0/24 list=Google_IP
add address=104.132.189.0/24 list=Google_IP
add address=104.132.190.0/24 list=Google_IP
add address=104.132.192.0/24 list=Google_IP
add address=104.132.196.0/24 list=Google_IP
add address=104.132.198.0/24 list=Google_IP
add address=104.132.199.0/24 list=Google_IP
add address=104.132.200.0/24 list=Google_IP
add address=104.132.201.0/24 list=Google_IP
add address=104.132.203.0/24 list=Google_IP
add address=104.132.205.0/24 list=Google_IP
add address=104.132.206.0/24 list=Google_IP
add address=104.132.207.0/24 list=Google_IP
add address=104.132.210.0/24 list=Google_IP
add address=104.132.211.0/24 list=Google_IP
add address=104.132.212.0/24 list=Google_IP
add address=104.132.213.0/24 list=Google_IP
add address=104.132.214.0/24 list=Google_IP
add address=104.132.215.0/24 list=Google_IP
add address=104.132.216.0/24 list=Google_IP
add address=104.132.222.0/24 list=Google_IP
add address=104.133.0.0/24  list=Google_IP
add address=104.133.1.0/24  list=Google_IP
add address=104.133.2.0/23  list=Google_IP
add address=104.133.4.0/24  list=Google_IP
add address=104.133.5.0/24  list=Google_IP
add address=104.133.6.0/24  list=Google_IP
add address=104.133.7.0/24  list=Google_IP
add address=104.154.0.0/15  list=Google_IP
add address=104.196.0.0/14  list=Google_IP
add address=104.237.160.0/19 list=Google_IP
add address=104.237.188.0/24 list=Google_IP
add address=104.237.189.0/24 list=Google_IP
add address=104.237.191.0/24 list=Google_IP
add address=107.167.160.0/19 list=Google_IP
add address=107.178.192.0/18 list=Google_IP
add address=108.59.80.0/20  list=Google_IP
add address=108.170.192.0/18 list=Google_IP
add address=108.177.0.0/17  list=Google_IP
add address=108.177.8.0/24  list=Google_IP
add address=108.177.9.0/24  list=Google_IP
add address=108.177.10.0/24 list=Google_IP
add address=108.177.11.0/24 list=Google_IP
add address=108.177.12.0/24 list=Google_IP
add address=108.177.13.0/24 list=Google_IP
add address=108.177.14.0/24 list=Google_IP
add address=108.177.15.0/24 list=Google_IP
add address=108.177.30.0/24 list=Google_IP
add address=108.177.96.0/24 list=Google_IP
add address=108.177.97.0/24 list=Google_IP
add address=108.177.98.0/24 list=Google_IP
add address=130.211.0.0/16  list=Google_IP
add address=142.250.0.0/15  list=Google_IP
add address=146.148.0.0/17  list=Google_IP
add address=162.216.148.0/22 list=Google_IP
add address=162.222.176.0/21 list=Google_IP
add address=172.102.8.0/21  list=Google_IP
add address=172.102.8.0/24  list=Google_IP
add address=172.102.9.0/24  list=Google_IP
add address=172.102.10.0/24 list=Google_IP
add address=172.102.11.0/24 list=Google_IP
add address=172.102.12.0/23 list=Google_IP
add address=172.102.14.0/23 list=Google_IP
add address=172.110.32.0/21 list=Google_IP
add address=172.217.0.0/16  list=Google_IP
add address=172.217.0.0/24  list=Google_IP
add address=172.217.16.0/24 list=Google_IP
add address=172.217.24.0/24 list=Google_IP
add address=172.217.28.0/24 list=Google_IP
add address=172.217.30.0/24 list=Google_IP
add address=172.253.0.0/16  list=Google_IP
add address=173.194.0.0/16  list=Google_IP
add address=173.194.7.0/24  list=Google_IP
add address=173.194.32.0/24 list=Google_IP
add address=173.194.34.0/24 list=Google_IP
add address=173.194.35.0/24 list=Google_IP
add address=173.194.36.0/24 list=Google_IP
add address=173.194.37.0/24 list=Google_IP
add address=173.194.38.0/24 list=Google_IP
add address=173.194.39.0/24 list=Google_IP
add address=173.194.40.0/24 list=Google_IP
add address=173.194.41.0/24 list=Google_IP
add address=173.194.42.0/24 list=Google_IP
add address=173.194.44.0/24 list=Google_IP
add address=173.194.46.0/24 list=Google_IP
add address=173.194.53.0/24 list=Google_IP
add address=173.194.63.0/24 list=Google_IP
add address=173.194.64.0/24 list=Google_IP
add address=173.194.66.0/24 list=Google_IP
add address=173.194.67.0/24 list=Google_IP
add address=173.194.68.0/24 list=Google_IP
add address=173.194.69.0/24 list=Google_IP
add address=173.194.70.0/24 list=Google_IP
add address=173.194.73.0/24 list=Google_IP
add address=173.194.74.0/24 list=Google_IP
add address=173.194.76.0/24 list=Google_IP
add address=173.194.77.0/24 list=Google_IP
add address=173.194.78.0/24 list=Google_IP
add address=173.194.79.0/24 list=Google_IP
add address=173.194.112.0/24 list=Google_IP
add address=173.194.113.0/24 list=Google_IP
add address=173.194.117.0/24 list=Google_IP
add address=173.194.118.0/24 list=Google_IP
add address=173.194.119.0/24 list=Google_IP
add address=173.194.120.0/24 list=Google_IP
add address=173.194.121.0/24 list=Google_IP
add address=173.194.124.0/24 list=Google_IP
add address=173.194.132.0/24 list=Google_IP
add address=173.194.136.0/24 list=Google_IP
add address=173.194.140.0/24 list=Google_IP
add address=173.194.141.0/24 list=Google_IP
add address=173.194.142.0/24 list=Google_IP
add address=173.194.175.0/24 list=Google_IP
add address=173.194.192.0/24 list=Google_IP
add address=173.194.193.0/24 list=Google_IP
add address=173.194.194.0/24 list=Google_IP
add address=173.194.195.0/24 list=Google_IP
add address=173.194.196.0/24 list=Google_IP
add address=173.194.197.0/24 list=Google_IP
add address=173.194.198.0/24 list=Google_IP
add address=173.194.199.0/24 list=Google_IP
add address=173.194.200.0/24 list=Google_IP
add address=173.194.201.0/24 list=Google_IP
add address=173.194.202.0/24 list=Google_IP
add address=173.194.203.0/24 list=Google_IP
add address=173.194.204.0/24 list=Google_IP
add address=173.194.205.0/24 list=Google_IP
add address=173.194.206.0/24 list=Google_IP
add address=173.194.207.0/24 list=Google_IP
add address=173.194.208.0/24 list=Google_IP
add address=173.194.209.0/24 list=Google_IP
add address=173.194.210.0/24 list=Google_IP
add address=173.194.211.0/24 list=Google_IP
add address=173.194.212.0/24 list=Google_IP
add address=173.194.213.0/24 list=Google_IP
add address=173.194.214.0/24 list=Google_IP
add address=173.194.215.0/24 list=Google_IP
add address=173.194.216.0/24 list=Google_IP
add address=173.194.217.0/24 list=Google_IP
add address=173.194.218.0/24 list=Google_IP
add address=173.194.219.0/24 list=Google_IP
add address=173.194.220.0/24 list=Google_IP
add address=173.194.221.0/24 list=Google_IP
add address=173.194.222.0/24 list=Google_IP
add address=173.194.223.0/24 list=Google_IP
add address=173.255.112.0/20 list=Google_IP
add address=185.25.28.0/23  list=Google_IP
add address=185.150.148.0/22 list=Google_IP
add address=192.104.160.0/23 list=Google_IP
add address=192.158.28.0/22 list=Google_IP
add address=192.178.0.0/15  list=Google_IP
add address=199.192.112.0/22 list=Google_IP
add address=199.223.232.0/21 list=Google_IP
add address=206.126.251.0/24 list=Google_IP
add address=207.223.160.0/20 list=Google_IP
add address=208.65.152.0/22 list=Google_IP
add address=208.65.152.0/24 list=Google_IP
add address=208.68.108.0/22 list=Google_IP
add address=208.81.188.0/22 list=Google_IP
add address=208.117.224.0/19 list=Google_IP
add address=208.117.226.0/24 list=Google_IP
add address=208.117.227.0/24 list=Google_IP
add address=208.117.228.0/24 list=Google_IP
add address=208.117.233.0/24 list=Google_IP
add address=208.117.235.0/24 list=Google_IP
add address=208.117.246.0/24 list=Google_IP
add address=208.117.253.0/24 list=Google_IP
add address=209.85.128.0/17 list=Google_IP
add address=209.85.144.0/24 list=Google_IP
add address=209.85.145.0/24 list=Google_IP
add address=209.85.147.0/24 list=Google_IP
add address=209.85.200.0/24 list=Google_IP
add address=209.85.201.0/24 list=Google_IP
add address=209.85.202.0/24 list=Google_IP
add address=209.85.203.0/24 list=Google_IP
add address=209.85.232.0/24 list=Google_IP
add address=209.85.233.0/24 list=Google_IP
add address=209.85.234.0/24 list=Google_IP
add address=209.85.235.0/24 list=Google_IP
add address=209.107.176.0/20 list=Google_IP
add address=209.107.176.0/23 list=Google_IP
add address=209.107.182.0/23 list=Google_IP
add address=216.58.192.0/19 list=Google_IP
add address=216.58.200.0/24 list=Google_IP
add address=216.58.208.0/24 list=Google_IP
add address=216.58.209.0/24 list=Google_IP
add address=216.58.210.0/24 list=Google_IP
add address=216.58.211.0/24 list=Google_IP
add address=216.58.212.0/24 list=Google_IP
add address=216.58.213.0/24 list=Google_IP
add address=216.58.214.0/24 list=Google_IP
add address=216.58.215.0/24 list=Google_IP
add address=216.58.216.0/24 list=Google_IP
add address=216.58.217.0/24 list=Google_IP
add address=216.58.218.0/24 list=Google_IP
add address=216.58.219.0/24 list=Google_IP
add address=216.58.220.0/24 list=Google_IP
add address=216.58.221.0/24 list=Google_IP
add address=216.58.222.0/24 list=Google_IP
add address=216.58.223.0/24 list=Google_IP
add address=216.73.80.0/20 list=Google_IP
add address=216.239.32.0/19 list=Google_IP
add address=216.239.32.0/24 list=Google_IP
add address=216.239.33.0/24 list=Google_IP
add address=216.239.34.0/24 list=Google_IP
add address=216.239.35.0/24 list=Google_IP
add address=216.239.36.0/24 list=Google_IP
add address=216.239.38.0/24 list=Google_IP
add address=216.239.39.0/24 list=Google_IP
add address=216.252.220.0/22 list=Google_IP
add address=216.252.220.0/24 list=Google_IP
add address=216.252.221.0/24 list=Google_IP
add address=216.252.222.0/24 list=Google_IP



Step-2

Create the Mangle Rule to mark these traffics .


/ip firewall mangle
add action=mark-packet chain=prerouting comment=GGC_IN new-packet-mark="Google" passthrough=no src-address-list=Google_IP
add action=mark-packet chain=prerouting comment=GGC_OUT dst-address-list=Google_IP new-packet-mark=Google" passthrough=no



Step-3

Create the PCQ for 20 mbps .

/queue type
add kind=pcq name=GOOGLE_UP pcq-classifier=src-address pcq-rate=20M

add kind=pcq name=GOOGLE_DN pcq-classifier=dst-address pcq-rate=20M


Step-4

Create a sample queue using  PCQ .


/queue simple
add name=GOOGLE_20mbps packet-marks=Google" queue=GOOGLE_UP/GOOGLE_DN target="" total-queue=default



NOTE:This created sample queue should be exist on the TOP of the queues lists .



MIKROTIK :- Mikrotik port forwarding


Lets's you have a PC in your LAN your side with private IP and if you want access that device
from wan side so in this kind of scenario you have to use port forwarding in your mikrotik
to get the access .


Lets start the configuration and find my diagram below .



/ip firewall nat
add  chain=dstnat disabled=no dst-port=8075 protocol=tcp action=dst-nat to-addresses=192.168.1.2 to-ports=8075


                                                            OR



/ip firewall nat
add  chain=dstnat dst-address=11.11.11.11 disabled=no dst-port=8075 protocol=tcp action=dst-nat to-addresses=192.168.1.2 to-ports=8075

Note:-when you are accessing that device over the internet you have to use this port as 8075 

MIKROTIK:-How to Prioritize the SpeedTest.Net

Step-1


Use this following script to create a layer 7 with the name of Speed-test .


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


Step-2

/ip firewall mangle
add action=mark-connection chain=forward comment=SPEEDTEST.NET layer7-protocol=speedtest new-connection-mark=speedtest_conn
add action=mark-connection chain=prerouting new-connection-mark=speedtest_conn protocol=tcp src-port=8080
add action=mark-packet chain=prerouting connection-mark=speedtest_conn new-packet-mark=speedtest passthrough=no
add action=mark-connection chain=postrouting dst-port=8080 new-connection-mark=speedtest_conn protocol=tcp
add action=mark-packet chain=postrouting connection-mark=speedtest_conn new-packet-mark=speedtest passthrough=no



Step-3

Create the PCQ for per connections . Because if you will not create the pcq then it would not 
be more efficient so you have to create the PCQ and same I discussed on my previous blogs 
topics .

/queue type
add kind=pcq name=download-2mb pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-classifier=dst-address pcq-dst-address-mask=32 pcq-dst-address6-mask=64 pcq-limit=50 pcq-rate=2048k \
    pcq-src-address-mask=32 pcq-src-address6-mask=64 pcq-total-limit=2000
add kind=pcq name=upload-2mb pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-classifier=src-address pcq-dst-address-mask=32 pcq-dst-address6-mask=64 pcq-limit=50 pcq-rate=2048k \
    pcq-src-address-mask=32 pcq-src-address6-mask=64 pcq-total-limit=2000



Step-4


/queue simple
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment=Fir all users  direction=both disabled=no interface=all limit-at=0/0 max-limit=0/0 name=\
    Speedtest_net\ packet-marks=speedtest parent=none priority=8 queue=upload-2mb/download-2mb total-queue=default-small

MIKROTIK:How to block torent in your network using Layer 7

Step-1

Use this layer 7 regular expression for marking all the torrent contents .



/ip firewall layer7-protocol
add comment="All Torentz" name=layer7-bittorrent-exp regexp="^(\\x13bitt\
    orrent protocol|azver\\x01\$|get /scrape\\\?info_hash=get /announce\\\?inf\
    o_hash=|get /client/bitcomet/|GET /data\\\?fid=)|d1:ad2:id20:|\\x08'7P\\)[\
    RP]"


Create the filter rule for marking the traffic of torrent users .


Step-2

/ip firewall filter
add action=add-src-to-address-list address-list=Torrent-Conn \
    address-list-timeout=2m chain=forward layer7-protocol=\
    layer7-bittorrent-exp src-address=10.10.10.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=\

    10.10.10.0/24 src-address-list=!allow-bit



Block these ports for torrents's peer establishment .

Step-3

/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