Community discussions

MikroTik App
 
carlhjerpe
just joined
Topic Author
Posts: 13
Joined: Fri May 15, 2015 12:49 pm

[Feature Request] Being able to add static address-list entries from script

Mon Jul 25, 2016 5:34 pm

Well as i can see, from script there's no way to add something to address list permanently. Which would be nice in some cases, atm when you set timeout to infinite it still goes away on reboot.

Could this be fixed? :)

Best Regards
Carl
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7042
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: [Feature Request] Being able to add static address-list entries from script

Mon Jul 25, 2016 5:38 pm

Not sure what you mean
/ip firewall address-list add list=test address=1.1.1.1

address will stay there forever unless configuration is removed, router is reset, reinstalled or NAND destroyed.
 
carlhjerpe
just joined
Topic Author
Posts: 13
Joined: Fri May 15, 2015 12:49 pm

Re: [Feature Request] Being able to add static address-list entries from script

Mon Jul 25, 2016 9:29 pm

Not sure what you mean
/ip firewall address-list add list=test address=1.1.1.1

address will stay there forever unless configuration is removed, router is reset, reinstalled or NAND destroyed.
If you run it inside a script it'll be marked with a D, which means it'll go away once restarted. From terminal it stays forever.
Image
If i reboot my router all the SSH_Blocklist stuff will go away.
Best Regards
Carl
 
User avatar
jspool
Member
Member
Posts: 468
Joined: Sun Oct 04, 2009 4:06 am
Location: Oregon

Re: [Feature Request] Being able to add static address-list entries from script

Tue Jul 26, 2016 9:42 am

I run scripts that add static address list entries all the time and the following works perfectly for static entries.
/ip firewall address-list add address=1.2.3.4 list=My-List
Now if you use the one below it will become dynamic since I specified "timeout"
 /ip firewall address-list add address=1.2.3.4 list=My-List timeout=30d
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7042
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: [Feature Request] Being able to add static address-list entries from script

Tue Jul 26, 2016 11:18 am

Exactly, if you want to add addresses permanently, do not specify timeout.
 
carlhjerpe
just joined
Topic Author
Posts: 13
Joined: Fri May 15, 2015 12:49 pm

Re: [Feature Request] Being able to add static address-list entries from script

Wed Aug 17, 2016 12:40 pm

I'm so stupid, what i did was i created them from a firewall rule... I'm terribly sorry!

Image

This makes it dynamic, i guess i'll have to make a script iterating that list and adding them from script to another list.

Made a script for this:

EDIT:
:foreach i in=[/ip firewall address-list find list=SSH_Blocklist] do={
    :local ipaddress [/ip firewall address-list get $i address]
    :local dynamic [/ip firewall address-list get $i dynamic]
    if ($dynamic = true) do={
        /ip firewall address-list remove $i
        /ip firewall address-list add list=SSH_Blocklist address=$ipaddress
    }
}

Who is online

Users browsing this forum: EmuAGR, ppawe, sas2k, TheCat12, truefriendcz and 72 guests