Please do help in my simple code, i do like to log all the dst-address of the certain ip, but it returns invalid item number here’s my code
/ip firewall connection
:foreach ip in=[get [find] src-address] do={
:local src [:pick $ip [:find $ip "10.0.4.240"] ([:len $ip] - 6)]
:local dstResult [/ip firewall connection get [find src=$src] dst-address]
:log warning $dstResult
}
Can not work, because after just a moment some connections timed out and the “get” return error because the connection not longer exist.
Increase “timeout” if needed, do not remove it.
/ip firewall connection
:foreach idc in=[find where (timeout>2) and src-address~"0.0.0.0"] do={
:log warning [get $idc dst-address]
}
thankyou for your reply again sir, ill try this code.
what if in /tool torch sir? does it work ?
You can add this on top of your nat rules, it add dynamically any contacted IP, of any protocol, to one firewall address-list thisaddlist
/ip firewall nat
add action=add-dst-to-address-list address-list=thisaddlist address-list-timeout=none-dynamic chain=srcnat dst-address-list=!thisaddlist \
src-address=10.0.4.240
What could be wrong sir? , i cant also capture the torch dst-address, what should i do? here’s my code
/tool torch
:foreach idc in=[find where interface="vlan10-Hotspot" and src-address~"12.0.4.240" and (timeout>2) ] do={
/file print file="dst-address.txt"
/file set "dst-address.txt" content=$idc
}
so much appreciated sir, ill try it too. thankyou so much
Sorry, my error, on previous post the chain=srcnat, already fixed.
It works sir, thankyou so much, so so so much appreciated!!!
woah , you know tagalog sir ? are you a Filipino ?
No, you are always kind, and to be kind I wanted to thank you in your language 