I recently bought the Mikrotik "Chateau", which is capable of LTE.
I would like to have such configuration profile :
DHCP-client on WAN_BRIDGE(ether1) + L2TP-client. If link fails : LTE interface goes up and L2TP reconnect through LTE
I have tried two different ways :
A) Using PPP profiles "On-up" and "On-down". But there I am facing an issue with this, whenever the link is down, it just repeats the "on-down script" causing LTE and L2TP to flap (looping over enabling LTE)
B) Using two different scripts.
The problem of my scripting is that it causes a service cut for sure.
The script below runs every 30 sec, checks if l2tp-out1 is running (LTE is disabled). If not, it enables LTE, disables WAN_BRIDGE (I found that it might be necessary to disable WAN_BRIDGE because of the default route causing the l2tp interface to be flapping) and then L2TP reconnects automatically through LTE.
Second script : (running ever houry or so) : Disables LTE, enables WAN_BRIDGE back for DHCP client,:global l2tpout1disabled [ /interface get l2tp-out1 disabled ];
:global l2tpoutltestate [ /interface get l2tp-outlte running ];
:global ltedisabled [ /interface get lte1 disabled ];
:if ( $l2tpout1state = false ) do={
:log warning "l2tp-out1 is down"
:if ($ltedisabled = true) do={
:if ($l2tpoutltedisabled=true) do={
/interface set lte1 disabled=no
/interface set l2tp-outlte disabled=no
/interface set l2tp-out1 disabled=yes
/interface set WAN_BRIDGE disabled=yes
}
}
}
I noticed that when LTE goes up because of a link down, the dhcp-client route is not being automatically removed (sometime causing l2tp interface to ignore and try to connect over dhcp-client, obviously failing.):global l2tpout1state [ /interface get l2tp-out1 running ];
:global l2tpout1disabled [ /interface get l2tp-out1 disabled ];
:global ltestate [ /interface get lte1 running ];
:global ltedisabled [ /interface get lte1 disabled ];
:global wandisabled [/interface get WAN_BRIDGE disabled];
:global wangateway [/ip dhcp-client get [find interface=WAN_BRIDGE] gateway]
:set wangateway [:pick $wangateway 0 [:find $wangateway "/" -1]]
/interface set lte1 disabled=yes
/interface set WAN_BRIDGE disabled=no
delay 30s;
:if ([/ping 8.8.8.8 interval=1 count=5]=0) do={
:log warning "wan_bridge still down"
/interface set WAN_BRIDGE disabled=yes
/interface set l2tp-out1 disabled=yes
/interface set lte1 disabled=no
} else {
:log warning "Ftth is back"
/interface set lte1 disabled=yes
/interface set WAN_BRIDGE disabled=no
/interface set l2tp-out1 disabled=no
}
Is there another way of achieving what I am trying to do ? A more "stable" way of doing this ?
I am in 7.1beta5 version.