Community discussions

 
Fritzman
just joined
Topic Author
Posts: 15
Joined: Tue Aug 18, 2009 8:53 pm

Update static route from dynamic route?

Sat Jan 19, 2019 12:02 pm

Hi,

we use policy based routing with two default routes (two different routing marks).
We need default routes for unmarked traffic as well. Therefore we have two default routes without routing marks.
One is the primary (distance 1) and one the backup (distance 2). This works great so far.

Unfortunately the primary uplink has a DHCP-IP. Now we have update the route for unmarked traffic each time the WAN-IP changes.
We would need a script that checks if the gateway of the dynamic route (WAN-KDE) has changed and update the gateway of the static route (for unmarked traffic).

routes.jpg

Thanks.
You do not have the required permissions to view the files attached to this post.
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1783
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: Update static route from dynamic route?

Sat Jan 19, 2019 12:43 pm

Hey

why not use the dhcp client script for that: when any ip data changes this script is executed https://wiki.mikrotik.com/wiki/Manual:I ... pt_example
 
Fritzman
just joined
Topic Author
Posts: 15
Joined: Tue Aug 18, 2009 8:53 pm

Re: Update static route from dynamic route?

Sat Jan 19, 2019 2:41 pm

Wow nice, exact what we need! Thanks a LOT!

For all who search and need such a solution as well: let the option "add default route" in the DHCP-client enabled. This will create two routes, one with the routing mark (created by the script) and one without routing mark (for all unmarked traffic, created by the DHCP-client -> option "add default route").

Edit the script to your routing mark, "WAN1" is in the example, simply change all "WAN1" to your routing mark. And DO NOT remove the comment form the route created by the script!!

Who is online

Users browsing this forum: No registered users and 15 guests