Community discussions

MikroTik App
 
edmidor
Member Candidate
Member Candidate
Topic Author
Posts: 126
Joined: Fri Mar 05, 2010 12:06 am
Location: Canada
Contact:

API to control Filter/Mangle

Tue Jun 22, 2010 4:01 am

Somehow I can't find how to enable/disable specific Filter/Mangle rules using API.
Is it possible?
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API to control Filter/Mangle

Thu Jun 24, 2010 12:47 am

sure.

1) specify, what is 'specific'
2) find necessary rule with query syntax
3) do what you want =)
 
edmidor
Member Candidate
Member Candidate
Topic Author
Posts: 126
Joined: Fri Mar 05, 2010 12:06 am
Location: Canada
Contact:

Re: API to control Filter/Mangle

Thu Jun 24, 2010 3:42 am

Well, I suppose I could identify the filter record by # if it's at all possible.
All I need at this stage is enable/disable, but I can't find any example doing anything similar to that
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API to control Filter/Mangle

Thu Jun 24, 2010 4:16 am

yep. for example, you need to disable a rule with src-address=192.168.0.1. first you should call
/ip/firewall/filter/print
?src-address=192.168.0.1
=.proplist=.id
(not sure about 192.168.0.1 - probably you will need 192.168.0.1/32)

it will return something like
!re
=.id=*BEEF
then you call
/ip/firewall/filter/disable
=.id=*BEEF
that's it =)

Who is online

Users browsing this forum: GoogleOther [Bot], LunaticRv, panzermaster18, Sob, UkRainUa and 46 guests