Community discussions

MikroTik App
 
User avatar
LatinSuD
Member Candidate
Member Candidate
Topic Author
Posts: 181
Joined: Wed Jun 29, 2005 1:05 pm
Location: Spain
Contact:

ECMP on dynamic interfaces

Mon Dec 19, 2005 10:12 pm

We're trying Equal Cost Multi-Path routing on 2 Dsl lines. One of them has static address and the second one has a dynamic PPPoE address.

If we wanted to do ECMP we'd need to create a single rule with both gateways. Eg:

/ip add dst-address=0.0.0.0/0 gateway=80.80.80.1,70.70.70.1 scope=255 target-scope=10 routing-mark=p2p comment="" disabled=no

But we usually cannot know gateway as it is dynamic, so what to do?
We may also have same gateway through 2 DSL lines but with different ip addresses... so how to do it?

Thanks.
 
changeip
Forum Guru
Forum Guru
Posts: 3830
Joined: Fri May 28, 2004 5:22 pm

Mon Dec 19, 2005 10:30 pm

I think you will need to write a script to pull that dynamic gateway ip and enter it into a route with x.x.x.x,y.y.y.y format. I wrote something similiar to take the dhcp gateway and apply it... see if you can use this with small modifications:
:log info "Checking default gateway for dhcp interfaces."

:local theName [ /ip dhcp-client get [/ip dhcp-client find status=bound ] interface ] 
:local currentGateway [ /ip dhcp-client get [/ip dhcp-client find status=bound ] gateway ] 
:local existingGateway [ /ip route get [/ip route find comment=$theName] gateway ]

:log info ( $currentGateway . " - " . $existingGateway )

:if ($currentGateway != $existingGateway) do={

  :log info ("Setting default gateway for " . $theName)
  :local a [ /ip route find comment=$theName ]

  :if ([ :typeof $a ] = nil ) do={ 

    :log info "adding route..."
    /ip route add dst-address=0.0.0.0/0 gateway=$currentGateway routing-mark=$theName comment=$theName

   } else={

    :log info "changing route..."
    /ip route set $a gateway=$currentGateway

} else={

  :log info "No route changes needed."

}



This isn't 100% going to work for your situation but you should be able to tweak it for you use. If not, wait a week and I will do it because I now have the same situation.

Sam

Who is online

Users browsing this forum: Google [Bot], kakiharaNL and 120 guests