Community discussions

MikroTik App
 
Riajul74
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 68
Joined: Sun Feb 10, 2013 12:01 am

Script if any connection fails

Sat Jun 29, 2013 4:30 pm

I am looking for a automatic email notification from my router RB450. I have setup email configuration and test is ok.

now, i have two connection from two ISP. i want to make a script if any one connection fail/unreachable will send router through other connection automatically.

can anybody help me with this ?
 
User avatar
c0d3rSh3ll
Long time Member
Long time Member
Posts: 557
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: Script if any connection fails

Fri Jul 05, 2013 9:25 am

first you need add a route static for check remote host like 8.8.8.8 and 208.67.222.222

for isp1
ip route add dst-address=8.8.8.8 gateway=192.168.1.1
and other
for isp2
ip route add dst-address=208.67.222.222 gateway=192.168.2.1

and then add two netwatch rule.
/tool netwatch
add disabled=no down-script="sys scrip run email_ISP1_down" host=8.8.8.8 interval=20s timeout=1s \
    up-script=""
add disabled=no down-script="sys scrip run email_ISP2_down" host=208.67.222.222 interval=20s timeout=\
    1s up-script=""
 
Riajul74
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 68
Joined: Sun Feb 10, 2013 12:01 am

Re: Script if any connection fails

Thu Jul 11, 2013 10:19 pm

thanks bro a lot. its helped me such your point shown. just i changed something myself for working good.

i have not added any route as you shown. i just added on network watch like below

/tool netwatch
add disabled=no down-script="sys scrip run email_ISP1_down" host=(ISP 1 gateway) interval=20s timeout=1s \
up-script=""
add disabled=no down-script="sys scrip run email_ISP2_down" host=(ISP 2 gateway) interval=20s timeout=\
1s up-script=""
 
Riajul74
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 68
Joined: Sun Feb 10, 2013 12:01 am

Re: Script if any connection fails

Thu Jul 11, 2013 11:24 pm

first you need add a route static for check remote host like 8.8.8.8 and 208.67.222.222

for isp1
ip route add dst-address=8.8.8.8 gateway=192.168.1.1
and other
for isp2
ip route add dst-address=208.67.222.222 gateway=192.168.2.1

and then add two netwatch rule.
/tool netwatch
add disabled=no down-script="sys scrip run email_ISP1_down" host=8.8.8.8 interval=20s timeout=1s \
    up-script=""
add disabled=no down-script="sys scrip run email_ISP2_down" host=208.67.222.222 interval=20s timeout=\
    1s up-script=""
can you please now help me to stop video steaming from any site ? i tried this

/ip firewall layer7-protocol add name=http-video regexp="http/(0.9|1.0|1.1)[x09-x0d ][1-5][0-9][0-9][x09-x0d -~]*(content-type: video)"
/ip firewall mangle add action=mark-packet chain=prerouting comment="http-video mark-packet" disabled=no layer7-protocol=http-video new-packet-mark=http-video passthrough=no
/queue simple add max-limit=0/64000 name=http-video packet-marks=http-video

but its not totally working. btw i am using hotspot loging system

Who is online

Users browsing this forum: lurker888, nichky and 97 guests