Script for Tunnel

Hi Guys,

Is there any script to check if the tunnel is alive or to make the tunnel active as always?

On our end we are experiencing some issue when accessing the sites every random time they’re not accessible, but when I refresh the tunnel (click the specific tunnel and click ok) it will successfully accessible via web.
I assumed that when no one access the site or server, the tunnel sleeps or break that’s the time we refresh the tunnel and can access the sites/server. Upon checking the logs, no status was shown for the tunnel.

Thanks in Advance.

what is the type of the tunnel?

but anyway, you can use keepalives to make sure, the tunnel is actually transmitting traffic, and it will then go “down” if it doesn’t. like keepalive=10s,4 - that means keepalive message is sent every 10seconds, and after 4 consecutive misses the tunnel is declared to be down.

then you can use a periodic script to check the tunnel state:

[me@router] /interface eoipv6> :put [/interface eoip get name-of-the-tunnel-here running]      
true

so in general

if (! [/interface eoip get name-of-the-tunnel-here running]) do={
    #insert your magic here to fix the tunnel
}

i’m just guessing, but maybe you have tunnels w/o keepalive, then if there’s no traffic, some intermediate router (firewall) will just declare the session closed, and block further packets. but as soon you do some action, the initial steps are taken again, then the session in the intermediate device is again detected and goes to established state. it can be a 3rd party box as well that creates you problems along the forwarding path.

It’s a IPsec we established.

Is the keep alive status visible in winbox? or just configure it via terminal? Thanks!!