persistent address-list

Hi,

Everytime i reboot my routerboard, the addresses that has been added to the "address-list"s disappears.
Is there any way to get them to be saved on the routerboards persistent memory directly instead?

I can export the address-lists to a file manualy, but i would like to it automaticly. And then not have to populate the address-lists, again manually.

Maybee a script could do this, don’t know how to do it though :slight_smile:


Hoping someone can be kind enough to help me out here.

/Daniel

When you export the address-list, dynamic entries are not saved. You have to run a script to convert all dynamic entries to static ones. After this, they will remain even after reboot. Set this script to run on a schedule every 5 mins and you’ll be all set.

:local comment
:local address
:local list
:local disabled

/ip firewall address-list
:foreach a in=[find] do={
   :if ([get $a dynamic] = true) do={
      :set comment [get $a comment]
      :set address [get $a address]
      :set list [get $a list]
      :set disabled [get $a disabled]
      remove $a
      add address=$address list=$list comment=$comment disabled=$disabled
   }
}

Thank you,

This was just what I was looking for!


/Daniel

Or you can write just:

/ip firewall address-list set [find dynamic=yes] dynamic=no