The situation is like this. I have two PPPoE connections. With one provider is a dynamic gateway, and one static. I have 2 routing mark. with one is marked "free zone" to a provider, and other internet provider to another. at the first where the static gateway, default route is created with the appropriate routing mark, and it works. I have a problem with this with a dynamic gateway. I found a script that dynamically finds the gateway to the PPPoE client connection, and that creates defoult route with the appropriate routing mark and gateway, but that script not working on my v4.6
![Sad :(](./images/smilies/icon_sad.gif)
Here's the script:
# name of interface that should be monitored
# (edit to match your interface name)
:set mInterface my_pppoe_connection;
# routing mark name used for default route that should be updated
# (edit to match your routing mark name)
:set mRoutingMark my_other_routing_mark;
/ip address ;
:set mAddress [find interface=$mInterface] ;
:set mGateway [get $mAddress network] ;
/ip route ;
:set mGatewayFound 0
:foreach i in [find routing-mark=$mRoutingMark] do={ \
:set mDstAddress [get $i dst-address]; \
:set qResult [:find $mDstAddress "0.0.0.0/0"]; \
:if ($qResult = 0) do={ \
set $i gateway=$mGateway ; \
:put "gateway rule adjusted"; \
:set mGatewayFound 1; \
}; \
};
:if ($mGatewayFound = 0) do={ ; \
add dst-address=0.0.0.0/0 gateway=$mGateway routing-mark=$mRoutingMark; \
:put "gateway rule added"; \
};
If I understand it, this script needs to create a default route for the given data from the PPPoE connection that I have configured and routing mark that I configured. it to me just does not work. script does not create a default route to this information. what's wrong with this script? can someone help me? thanks!