Community discussions

MikroTik App
 
erfanmazraei
just joined
Topic Author
Posts: 6
Joined: Tue Oct 05, 2021 10:24 pm

filtering for one ip

Tue Oct 05, 2021 10:29 pm

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 ?
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3300
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: filtering for one ip

Wed Oct 06, 2021 10:28 am

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??????
 
ConnyMercier
Forum Veteran
Forum Veteran
Posts: 725
Joined: Tue Dec 17, 2019 1:08 pm

Re: filtering for one ip

Wed Oct 06, 2021 10:55 am

Randomly fiter 8 packet from 10 packet :lol: :lol:

Someone want to play a prank/practical Joke on their coworkers!!
 
erfanmazraei
just joined
Topic Author
Posts: 6
Joined: Tue Oct 05, 2021 10:24 pm

Re: filtering for one ip

Wed Oct 06, 2021 12:52 pm

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??????
yessss
i want filter 80% of packet
 
ConnyMercier
Forum Veteran
Forum Veteran
Posts: 725
Joined: Tue Dec 17, 2019 1:08 pm

Re: filtering for one ip

Wed Oct 06, 2021 2:00 pm

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
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3300
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: filtering for one ip

Wed Oct 06, 2021 3:29 pm

yessss
i want filter 80% of packet
Why? This will only result in problems..
 
erfanmazraei
just joined
Topic Author
Posts: 6
Joined: Tue Oct 05, 2021 10:24 pm

Re: filtering for one ip

Wed Oct 06, 2021 3:39 pm

yessss
i want filter 80% of packet
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
Last edited by erfanmazraei on Wed Oct 06, 2021 3:51 pm, edited 1 time in total.
 
erfanmazraei
just joined
Topic Author
Posts: 6
Joined: Tue Oct 05, 2021 10:24 pm

Re: filtering for one ip

Wed Oct 06, 2021 3:49 pm

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
oh tnx but it dosnt work ):
you test it ?
 
erfanmazraei
just joined
Topic Author
Posts: 6
Joined: Tue Oct 05, 2021 10:24 pm

Re: filtering for one ip

Wed Oct 06, 2021 3:53 pm

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
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
 
ConnyMercier
Forum Veteran
Forum Veteran
Posts: 725
Joined: Tue Dec 17, 2019 1:08 pm

Re: filtering for one ip

Wed Oct 06, 2021 4:51 pm

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"
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 2098
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Krugersdorp (Home town of Brad Binder)
Contact:

Re: filtering for one ip

Wed Oct 06, 2021 5:23 pm

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
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3300
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: filtering for one ip

Wed Oct 06, 2021 5:42 pm

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.
 
erfanmazraei
just joined
Topic Author
Posts: 6
Joined: Tue Oct 05, 2021 10:24 pm

Re: filtering for one ip

Wed Oct 06, 2021 6:32 pm

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 ?
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3300
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: filtering for one ip

Wed Oct 06, 2021 9:27 pm

Google

mikrotik queuing

Who is online

Users browsing this forum: Bing [Bot] and 31 guests