Community discussions

 
parscon
newbie
Topic Author
Posts: 33
Joined: Mon Dec 02, 2013 4:17 pm

Delete all connection in Firewall-Connections

Wed Jan 13, 2016 11:11 am

Hello to all
I need a Script that can delete all connections in IP--->Firewall--->Connections
I use this below script but it does not remove all .
/ ip firewall connection {:foreach r in=[find] do={remove $r}}
Please help me .
Best Regards
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Delete all connection in Firewall-Connections

Wed Jan 13, 2016 1:58 pm

/ip firewall connection remove [find]
?
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
keithy
newbie
Posts: 25
Joined: Sat Aug 07, 2010 7:00 pm

Re: Delete all connection in Firewall-Connections

Wed Jan 13, 2016 10:28 pm

/ip firewall connection tracking set enabled=no
:delay 5s
/ip firewall connection tracking set enabled=yes


adjust delay depending upon how many or few connections you're trying to clear

HTH
 
tullaman
just joined
Posts: 1
Joined: Wed Nov 05, 2014 9:41 pm

Re: Delete all connection in Firewall-Connections

Mon Feb 05, 2018 1:18 pm

Hi All,

boen_robot's answer works for me.

The idea about enabling and disabling conn-tracking for a few secs and then re-enabling didn't work - I tried durations of up to a minute. Maybe reducing the standard connection timeout duration to something less that the period for which conn-track gets disabled would work? But as I said boen_robot's answer does the business.

/Tullaman.
 
User avatar
pothi
just joined
Posts: 9
Joined: Fri Sep 14, 2018 7:48 pm
Location: Srivilliputhur, Tamil Nadu, India
Contact:

Re: Delete all connection in Firewall-Connections

Sat Feb 02, 2019 5:29 am

Thanks @boen_robot .

Your code / answer still works. I had a small but annoying issue upon failover when the existing connections do not switch to the new ISP. Clearing the existing connections using your code solved the issue.
Love breaking things and start over!
 
yreks
just joined
Posts: 7
Joined: Sat Aug 16, 2014 5:53 pm

Re: Delete all connection in Firewall-Connections

Sat Feb 02, 2019 7:56 am

If there are a lot of connections - about 5600,
then I had to run to clean

/ ip firewall connection remove [find]

5 times.

At first I received a response in the terminal

no such item (4)

Who is online

Users browsing this forum: No registered users and 2 guests