Hi I’m trying to remove a connection from a script but I can’t seem to get it to work.
On the Mikrotik box after visually getting the connection number with:
/ip firewall connection print
and removing with:
/ip firewall connection remove 5
This is no problem from a Mikrotik terminal/console.
However if I put this command in a script or try to execute via ssh I get the following error:
(run from a linux server)
What I want to do is look for a specfic connection based on some criteria eg. connection-type or whatever.
Then capture the connection number and remove it.
I am able to do all of the above programatically except remove the connection.
This it seems is only successfull when run from the terminal directly on the Mikrotik.
What am I missing?
Fair enough but the
/ip firewall connection remove command
only seems to except an id number.
How would I remove a specific connection (As I would from the gui) ?
I’ve looked at this thread: http://forum.mikrotik.com/t/remove-all-connections/4727/1
They seem to have the same problem.
find doesn’t produce any results.
Thanks, I could have swore I tried that exact command with no results… ???
However could you be a little more specific?
I don’t know what to do with that output?
I want a way to list and then remove an item.
To be more specific… (for example)
I want to remove anything with dst-address=1.1.1.1:111
Thanks again in advance.
!!! I got it.!!!
Thanks to your help and alot of digging the command I’m using is
/ip firewall connection {:foreach i in [find dst-address=“1.1.1.1:111”] do={remove $i}}