filtering for one ip

hi
i have a haplite router mikrotik
i wana to write new script for filter a one ip like 192.168.1.1 ، but i dont want filter all packet for this ip
i want to filter randomly filter packet from this ip
for examole i want fiter 8 packet from 10 packet and 2 packet not be filter

any oneare here to help me ?

Sounds more like noe need filter rules (firewall) not script.
What do you like to do with 20% of the packets from/to IP 192.168.1.1? Drop them???

Randomly fiter 8 packet from 10 packet :laughing: :laughing:

Someone want to play a prank/practical Joke on their coworkers!!

yessss
i want filter 80% of packet

Try something like this ,

/ip firewall filter
add action=drop chain=forward packet-mark=PMark_RandomBlock
/ip firewall mangle
add action=mark-connection chain=prerouting new-connection-mark=\
    CMark_RandomBlock passthrough=yes src-address=192.168.1.1
add action=mark-packet chain=prerouting connection-mark=CMark_RandomBlock \
    new-packet-mark=PMark_RandomBlock passthrough=yes random=80

Why? This will only result in problems..

i have miner and my pool is viabtc pool
and i istall a new firmwirre on my miner to overclock
but the owner of this firmwire , get 2% of my benefit
he set two pool on this in this firmwire , and his pool is slushpool

ok ?

my pool → viabtc
his pool → slushpool

2% of all benefit of my miner forward to slushpool
if your question is a how ?!
slushpool and viabtc pool , send work for my miner , and then my miner do their work and slushpool and viabtc , get me bitcoin for benefit
because of i install this firmwire , 98% of all work that my miner can do it , is from my pool ( viabtc ) and 2% of all work is from his pool ( slush pool ) , ok ?

if i can filter some work (packet from slushpool to my miner ) , my miner get more than 98% of work from viabtc (: (like 99.5 %)
then i must filter 80% of input packet that from slushpool

i can filter all packet from slushpool but , if i do it , this firmwire dosnt work (:
and now , i want to filter some packet
this job decrease 2% to like 0/3%

do you understand ?
my languege is not english and excuse me if i cant speak very well (:
and help me for this job
please

oh tnx but it dosnt work ):
you test it ?

this code filter input trafick from 192.168.1.1 ?!
i want to filter input trafick from 192.168.1.1

you think that slushpool ip → 192.168.1.1

Like @Jotne sayed to block 80% of Packets will only result in Problems.
So the Script that block 80% of packets is of course useless =)

I am not i mining Expert… But Maybe “Queues” will help…
A simple “Queue Tree” for the Download could regulate the mining of the “slushpool-User”

Not sure exactly what you want to achieve, and will probably just cause a lots of retransmits of packets in your network, but maybe below is a starting point which you can expand / amend to your liking with additions like connection marking, etc.

/ip firewall filter
add action=drop chain=input nth=5,1 protocol=icmp
add action=drop chain=input nth=4,1 protocol=icmp
add action=drop chain=input nth=3,1 protocol=icmp
add action=drop chain=input nth=2,1 protocol=icmp

With above, I get the below results, which is blocking 80% of the packets

Pinging 192.168.168.79 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from 192.168.168.79: bytes=32 time<1ms TTL=64
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from 192.168.168.79: bytes=32 time<1ms TTL=64
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from 192.168.168.79: bytes=32 time=4ms TTL=64
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from 192.168.168.79: bytes=32 time<1ms TTL=64
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Reply from 192.168.168.79: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.168.79:
    Packets: Sent = 25, Received = 5, Lost = 20 (80% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 4ms, Average = 0ms

As other writes, you should not remove any IP package. You can on other hand use Queue limit and give 80/20 to the two involved IP.

how ?

Google

mikrotik queuing