# Remove Nat Sessions on a specific event

**URL:** <https://forum.mikrotik.com/t/remove-nat-sessions-on-a-specific-event/149214>\
**Category:** Scripting\
**Created:** [May 20, 2021, 2:03pm UTC](https://forum.mikrotik.com/t/remove-nat-sessions-on-a-specific-event/149214 "2021-05-20T14:03:06Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![rextended](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/rextended/32/67729_2.png) [@rextended](https://forum.mikrotik.com/u/rextended)\
**Post date:** [October 11, 2021, 11:22am UTC](https://forum.mikrotik.com/t/remove-nat-sessions-on-a-specific-event/149214/19 "2021-10-11T11:22:56Z")

</div>

create a netwatch for that IP and put on both on-down and on-up this:

```plaintext
/ip fire conn
:foreach idc in=[find where (timeout > 60) and (reply-dst-address ~ "10.254.251.254")] do={
 remove [find where .id=$idc]
}

```

please do not alter the timeout

[http://forum.mikrotik.com/t/dual-wan-failover-script-ping-command/150516/1](http://forum.mikrotik.com/t/dual-wan-failover-script-ping-command/150516/1)

> I do not write the things without reason.  
> If just one connection on connection tracking is already closed for timeout (or other reasons) during the execution of the clean,  
> the script stop with error because when try the connection is already closed, and do not finish his works.

---

_[View the full topic](https://forum.mikrotik.com/t/remove-nat-sessions-on-a-specific-event/149214)._
