Community discussions

MikroTik App
 
markos222
just joined
Topic Author
Posts: 24
Joined: Tue Dec 15, 2015 9:15 pm

Remove connections via scrip when internet link down

Thu May 27, 2021 10:59 am

Hi,

I have a question,

Is there any posibility to remove connections via script , when the ppoe descconects? I have a problem with Voip when internet via ppoe disconnect,

I have this for remove connections but I don't know ho to do when ppoe disconnects

Any advice will be apreciated
/ip firewall connection remove [/ ip firewall connection find dst-address~"x.x.x.x:5060"]

Thank you
 
User avatar
tomaskir
Trainer
Trainer
Posts: 1162
Joined: Sat Sep 24, 2011 2:32 pm
Location: Slovakia

Re: Remove connections via scrip when internet link down

Thu May 27, 2021 6:26 pm

In "/ppp profile" you have the option to set "on-up" and "on-down" scripts.

Create a separate profile with your desired scripts, use that profile for your outbound PPPoE session.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Remove connections via scrip when internet link down

Thu May 27, 2021 6:32 pm

Hi,

I have a question,

Is there any posibility to remove connections via script , when the ppoe descconects? I have a problem with Voip when internet via ppoe disconnect,

I have this for remove connections but I don't know ho to do when ppoe disconnects

Any advice will be apreciated
/ip firewall connection remove [/ ip firewall connection find dst-address~"x.x.x.x:5060"]

Thank you

Please do some search instead of open new topic.

Is better to close all invalid connections than only the VoIP

viewtopic.php?f=9&t=154606&p=853803&hil ... ve#p853803

you can paste this on on-up script on profile used from pppoe-out1, do not change nothing, it retrieve automatically new pppoe ip (can be the same)
:global newIP [:tostr $"local-address"]

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

Who is online

Users browsing this forum: No registered users and 18 guests