Add a dynamic address to address-list
Posted: Thu Jun 24, 2010 2:49 pm
I need to add the address of the adsl interface (dynamic) to address-list.
I've tried to mark the new connection coming from that interface, but that doesn't work :
Also tried to use the script to get the address from the /ip address, and it works but has two problems:
1) I want the address list to be dynamic
2) The checkIP is not working, and therefore the address is constantly being added, even thought it exists
Here's the script:
I would appreciate if someone could lead me to a solution to add the address to a list (preferably dynamic, since the address changes and i won't be needing to nat the pre-updated addresses that doesn't exist anymore after the address update).
Thank you
I've tried to mark the new connection coming from that interface, but that doesn't work :
Code: Select all
chain=mark new unseen action=add-dst-to-address-list address-list=public
address-list-timeout=0s in-interface=ADSL
1) I want the address list to be dynamic
2) The checkIP is not working, and therefore the address is constantly being added, even thought it exists
Here's the script:
Code: Select all
:local checkIP 0;
:local a
:foreach i in [/ip address find interface=ADSL] do={
:set a [/ip address get $i address]
}
:set checkIP [/ip firewall address-list pr count-only where address=$a]
:if ($checkIP = 0) do={
/ip firewall address-list add address=$a list=public
}
Thank you