Community discussions

MikroTik App
 
MikroManagement
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 64
Joined: Thu Feb 09, 2006 2:41 pm
Location: Pretoria

Backup PPPoE connection

Thu Mar 23, 2006 9:55 pm

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
 
User avatar
RoddyZ
just joined
Posts: 20
Joined: Tue Dec 13, 2005 9:56 pm
Location: San Juan - Argentina
Contact:

Thu Mar 23, 2006 11:59 pm

Create the follow script and a scheduler each 5m to run it.



:global pppoe1-interface YourPppoe1InterfaceName
:global pppoe1-name YourPppoe1ConnectionName
:global pppoe2-name YourPppoe2ConnectionName

/interface pppoe-client enable [find name=$pppoe1-name]
:delay 5

:local pppoe1-ip [ /ip address get [/ip address find interface=$pppoe1-interface] address ]

:if ([ :typeof $pppoe1-ip ] != nil ) do={
:log info ("Conected to " . $pppoe1-name)
/interface pppoe-client disable [find name=$pppoe2-name]
} else={
:log info ("Connected to " . $pppoe2 -name)
/interface pppoe-client enable [find name=$pppoe2-name]
/interface pppoe-client disable [find name=$pppoe1-name]
}



-RoddyZ
 
MikroManagement
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 64
Joined: Thu Feb 09, 2006 2:41 pm
Location: Pretoria

Tue Mar 28, 2006 9:07 pm

Thanks!
 
MikroManagement
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 64
Joined: Thu Feb 09, 2006 2:41 pm
Location: Pretoria

Sun Sep 03, 2006 12:48 am

Refer to http://forum.mikrotik.com/viewtopic.php?t=10623 for an more updated version.
 
MikroManagement
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 64
Joined: Thu Feb 09, 2006 2:41 pm
Location: Pretoria

Wed Jan 10, 2007 11:14 pm

:local pppoe1-name ADSL_Saol0


:local pppoe2-name IBurst


:local dns-name smtp.isdsl.net

: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]
}

Who is online

Users browsing this forum: No registered users and 22 guests