I want to switch to my backup PPPoE connection as soon as my ADSL connection drops on the one line.
Actually the setup is more complex, I use 2x ADSL PPPoE connections to differentiate between local and international traffic. There are periods where both these connection cannot connect - I have acquired a connection on a different provider and would like to use this connection as a backup.
Can someone please help me to write a script that will basically works as follows?
Every 5 min
check if default PPPoE connection ip active (Running / IP address not nil)
if nil, then
Disable my routing scripts
Enable backup PPPoE connection
else
Disable backup PPPoE connection
I don’t want to use the backup PPPoE all times - more expensive than my normal connection and don’t want to do any sort of load balancing between these two gateways
:local dns-ip [/ip dns static get [/ip dns static find name $dns-name] address]
:local pppoe1-status ([/interface pppoe-client get [/interface pppoe-client find name $pppoe1-name] running ])
:local pppoe2-status ([/interface pppoe-client get [/interface pppoe-client find name $pppoe2-name] running ])
:local pppoe2-dg ([/interface pppoe-client get [/interface pppoe-client find name $pppoe2-name] add-default-route])
:local pppoe2-dns ([/interface ppoe-client get [/interface pppoe-client find name $pppoe2-name] use-peer-dns])
:if ($pppoe1-status = false) do {/interface pppoe-client enable [/interface pppoe-client find name $pppoe1-name]
:if ($pppoe2-dg = false) do [/interface pppoe-client set [/interface pppoe-client find name $pppoe2-name] add-default-route=yes]
:if ($pppoe2-dns = false) do [/interface pppoe-client set [/interface pppoe-client find name $pppoe2-name] use-peer-dns=yes]
:if ($pppoe2-status = false) do [/interface pppoe-client enable [/interface pppoe-client find name $pppoe2-name]]
:if ($dns-ip = 196.26.208.190) do [/ip dns static set [/ip dns static find name $dns-name] address 196.30.31.207]
:log info “Running on IBurst!”} else={:if ($pppoe2-dg = true) do [/interface pppoe-client set [/interface pppoe-client find name $pppoe2-name] add-default-route=no]
:if ($pppoe2-dns = true) do [/interface pppoe-client set [/interface pppoe-client find name $pppoe2-name] use-peer-dns=no]
:if ($pppoe2-status = false) do [/interface pppoe-client enable [/interface pppoe-client find name $pppoe2-name]]
:if ($dns-ip = 196.30.31.207) do [/ip dns static set [/ip dns static find name $dns-name] address 196.26.208.190]
}