Community discussions

MikroTik App
 
skipcube
just joined
Topic Author
Posts: 8
Joined: Tue Jun 23, 2015 6:16 pm

/ip/route gateway question

Wed Sep 23, 2015 11:45 pm

Hi all,
I have a route specified under /ip route
where I'm routing the following network over an l2tp interface. The interface is setup when the remoteserver calls into my server via L2TP/IPSec.
This works as long as the l2tp-interface is alive. But once the remote user disconnects and later reconnects reconnects, this route is marked unreachable due to the check via ping. So routing stops as there is no backup route. Is there way that route gets automatically enabled as soon as the interface comes back online after brief outage.

I could write a simple monitor script, but is there a setting I might have missed to allow automatic reenabling the route?
5 A S  dst-address=10.0.28.0/22 gateway=<l2tp-remoteserver> 
        gateway-status=<l2tp-remoteserver> reachable check-gateway=ping
        distance=1 scope=30 target-scope=10 
Thanks,
Skip
 
User avatar
rmmccann
Member Candidate
Member Candidate
Posts: 182
Joined: Tue Sep 25, 2012 11:15 pm
Location: USA

Re: /ip/route gateway question

Thu Sep 24, 2015 10:11 pm

Rather than have a static route, why not just use the "routes" entry in your PPP secret config for this user? The route will be added and removed automatically as the user connects and disconnects.
 
skipcube
just joined
Topic Author
Posts: 8
Joined: Tue Jun 23, 2015 6:16 pm

Re: /ip/route gateway question

Fri Sep 25, 2015 5:39 am

I had misread the documentation. Yes this works! Thanks rmmccann.
I also found a bug in RouterOS when testing this out. If I updated the routes in /ppp secret, it corrupts the secret and we need to reset the secret. Not sure how to report this to Mikrotik.

Just for benefit of others:
/ppp secret
routes (string; Default: ) Routes that appear on the server when the client is connected. The route format is: dst-address gateway metric (for example, 10.1.0.0/ 24 10.0.0.1 1). Several routes may be specified separated with commas. This parameter will be ignored for OpenVPN.
I had misread it thinking routes will appear on client.
 
User avatar
docmarius
Forum Guru
Forum Guru
Posts: 1222
Joined: Sat Nov 06, 2010 12:04 pm
Location: Timisoara, Romania
Contact:

Re: /ip/route gateway question

Fri Sep 25, 2015 7:24 am

The cause of this behavior of the routes is hidden in this element : gateway=<l2tp-remoteserver>

Internally, the route uses an numeric id to identify the interface (you can see it in e.g. in SNMP). Now the fact that your interface is dynamically created on connect makes this identifier to change on reconnect, because on reconnect, the old interface is deleted and a new interface is created, having the same name. This will render your previous route invalid.

To work around this, either use IP criteria to route traffic (e.g. gateway = 192.168.5.6) or create a static l2tp server binding for that connection. In that way, the interface will not change its ID dynamically, will be there even in disconnected state, and the route will be correct all the time.

Who is online

Users browsing this forum: adwlodaro, Bing [Bot], CGGXANNX, eugenq, homerouter, Luanscps, Yahoo [Bot] and 127 guests