Hi, I’ve an important task, the LAN network /24 is splitted in two parts, the first 127 addresses using the devault gateway with main routing table, the second half of the subnet should use another gateway, this i ssimple to obtain, I mangle the 192.168.0.128/25 addresses to use another routing table which I created.
Now the problem is that this second gateway is givng me an internal IP which may change in future, and by DHCP client I can’t define the routing table it has to be assigned, where I can mangle the traffic. To solve the problem I had to create a static default route to the gateway which actually I see on the DHCP client datas, works, but how can I created it automatic if the gateway address change?
Thanks
In the picture I show the differences between a dynamic route entry and a static one, it’s the same also for 0.0.0.0/0 route. I can’t uplead that scren because I’m afraid to activate it, I can loose the router remotely, I think you understood already
Thank you for kind answer, what is a Ros use? Mikrotik router OS? where are these dynamic rules and how can I use them? Sounds strange to me
I can use the script, but I consider it a dirty work, why Mikrotik simply don’t let us to assing a default gateway from dynamic connection to a routing table? This is also a mystery.
The only script posted there is this
:if ($bound=1) do={/ip route set [find where dst-address=0.0.0.0/0 routing-mark=ISP1] gateway=$"gateway-address" }
reading it it seams a partial solutin only, much more interesing is the script in the Mikrotik guide, but I don’t know how it behaves after the expiraiton (if it may be dangerous)
You should read “Dynamic” as “automatically created/managed by the (Router) Operating System, NOT by user”.
Yes, this is the script that may (if I got your question right) solve the issue:
:if ($bound=1) do={/ip route set [find where dst-address=0.0.0.0/0 routing-mark=ISP1] gateway=$"gateway-address" }
I don’t see in any way how it is dirty or partial, it simply detects when a change in DHCP settings happens and updates the route with the current (new) gateway.
I completely agree! And I truly hope Mikrotik implements a simpler solution like /routing/rule src-interface=xxxx or similar. Currently, you can only use /routing/rule src-address=xxxx which needs to be updated using a DHCP script, giving it a “dirty” feel.