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

Sun Sep 03, 2006 12:47 am

Refer to http://forum.mikrotik.com/viewtopic.php?t=7528

I have 2 PPPoE connections on different interfaces. As soon as my primary connection drops, it should connect on my secondary interface.

The proposed solution under refered thread does not work - I cannot work with the IP address of the interface to determine the PPPoE connection status, this IP is fixed...

My complete script is as follows
:global pppoe1-name ADSL_Connection
:global pppoe2-name ADSL_Backup

-- The following statement works ONLY if there is an IP assigned. If not, it bombs out
:local pppoe1-ip [ /ip address get [/ip address find interface=$pppoe1-name] address]

-- If the connection is not established, the rest DOES NOT execute ; not even this log info messages
:log info $pppoe1-ip

:if ([ :typeof $pppoe1-ip ] != nil ) do={
/interface pppoe-client disable [/interface pppoe-client find name $pppoe2-name]

:log info ("Conected to " . $pppoe1-name)

} else={
/interface pppoe-client set [/interface pppoe-client find name $pppoe2-name] add-default-route=yes
/interface pppoe-client enable [/interface pppoe-client find name $pppoe2-name]

:log info ("Conected to " . $pppoe2-name)
}



Any other to check if a connection is active? I have also tried the "get Status" on the pppoe-client interface, doesn't work.
 
MikroManagement
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 64
Joined: Thu Feb 09, 2006 2:41 pm
Location: Pretoria

Tue Sep 05, 2006 8:05 pm

Just basically need to check if the connection is active or not... The IP-assigned route does not work, any other way to see if a connection is up / down?
 
yogi
Frequent Visitor
Frequent Visitor
Posts: 63
Joined: Fri May 28, 2004 4:23 pm

Fri Sep 08, 2006 2:06 am

IP assigned route does not work?

You mean add a route for a specific IP the use netwatch. Does work, why not for you?
 
MikroManagement
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 64
Joined: Thu Feb 09, 2006 2:41 pm
Location: Pretoria

Mon Sep 11, 2006 10:53 pm

I use netwatch for watching my other connections, but in this scenario it won't work due to the fact that the backup line is not always connected. I know I can have a watch on my primary line, but this can also cause havoc...

All I need is to get the STATUS of a pppoe-client connection. On the Interface page, whether is is R (Running) or not... I cannot find any script that can return the 'Status' of an interface.
 
yogi
Frequent Visitor
Frequent Visitor
Posts: 63
Joined: Fri May 28, 2004 4:23 pm

Tue Sep 12, 2006 1:01 am

I know I can have a watch on my primary line, but this can also cause havoc...
How can this cause havoc?
All I need is to get the STATUS of a pppoe-client connection. On the Interface page, whether is is R (Running) or not... I cannot find any script that can return the 'Status' of an interface.
Like what?
:if ( [ /interface pppoe-client get PPPoE_Out running ] = true ) do={ :log error popsicle}
 
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]
}