Community discussions

MikroTik App
 
User avatar
LatinSuD
Member Candidate
Member Candidate
Topic Author
Posts: 181
Joined: Wed Jun 29, 2005 1:05 pm
Location: Spain
Contact:

Suggestion: Add a button to flush connections

Mon Sep 07, 2015 11:49 am

As we know connection management is a little limited (it shows at most 2048 connections).
There are times when you want to flush/clear all connections and it is hard to do it, even with scripts.

It would be great if there was a button/command to flush all connections at once.

For example, after a backup line change NAT can become invalid and being able to flush connections from a script would help.
 
upower3
Member
Member
Posts: 425
Joined: Thu May 07, 2015 11:46 am

Re: Suggestion: Add a button to flush connections

Mon Sep 07, 2015 12:50 pm

I'd add one more prey: please add a single robust command that will flush all connections.

This will be useful for debug, for using in script etc.

Yes I can go to connections tab and disable connection tracking then re-enable it again, but sometime it is not enough. And when you deal with WAN balancing you're definitely need something very robust to solve it!
 
marrold
Member
Member
Posts: 427
Joined: Wed Sep 04, 2013 10:45 am

Re: Suggestion: Add a button to flush connections

Mon Sep 07, 2015 1:03 pm

There are times when you want to flush/clear all connections and it is hard to do it, even with scripts.
What issues are you having with scripting this?
 
User avatar
LatinSuD
Member Candidate
Member Candidate
Topic Author
Posts: 181
Joined: Wed Jun 29, 2005 1:05 pm
Location: Spain
Contact:

Re: Suggestion: Add a button to flush connections

Thu Sep 10, 2015 3:37 pm

Where can I find a script that works?

All my attempts end in random errors about non-existing connections.

Also, and how many iterations do I have to try?
Remember I can only remove 2048 connections at once, and between iterations new connections can be created and destroyed.

Any scripted approach would be, not only in practice but also by definition, clumsy.
 
marrold
Member
Member
Posts: 427
Joined: Wed Sep 04, 2013 10:45 am

Re: Suggestion: Add a button to flush connections

Thu Sep 10, 2015 3:49 pm

I've not come across the 2048 limit but I deal with a low number of connections usually.


Quickest way
/ ip firewall connection tracking set enabled=no
/ ip firewall connection tracking set enabled=yes
 
User avatar
LatinSuD
Member Candidate
Member Candidate
Topic Author
Posts: 181
Joined: Wed Jun 29, 2005 1:05 pm
Location: Spain
Contact:

Re: Suggestion: Add a button to flush connections

Mon Sep 14, 2015 1:41 pm

Quickest way
/ ip firewall connection tracking set enabled=no
/ ip firewall connection tracking set enabled=yes
I have tried that and IIRC it didn't work as expected.
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Mon Sep 14, 2015 2:13 pm

Can you imagine what will happen when you disable the connection tracking when you rely on marking for routing? You can easily loose connection to the device without possibility to establish it again. But maybe it is not your case.
 
jthorn
just joined
Posts: 1
Joined: Wed Jul 26, 2017 7:25 pm

Re: Suggestion: Add a button to flush connections

Wed Jul 26, 2017 7:33 pm

This may have been answered in another board, however, I find the following script seems to flush all the existing connections. The WinBox seems to immediately reconnect without dropping on screen but your mileage may vary!

Script: /ip firewall connection remove [/ip firewall connection find];

It seems this works as a wild card, finds all connections and removes them in one line. Periodically you may get a statement that something is no longer present but I believe this is because the connection was dropped in between the find and remove command execution time slot.

If anyone is aware that this does not drop all existing connections please advise.
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: Suggestion: Add a button to flush connections

Thu Jul 27, 2017 1:57 pm

For too many items in conntrack table might be necessary to repeat the command several times. Maybe this is not actual with recent versions, I have not tried it for very long time...

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], connectthedots, Gilvan, H4ndr3, mspowell, nickolasm5 and 50 guests