Find Problem,
Posted: Sun Sep 04, 2005 2:38 am
Since I have several gateways (one without routing mark and others with routing marked for routing policy), I need to change them in a script. Using the exact example in docs (below), it changes all my default gateways.
/ip route set [/ip route find dst-address="0.0.0.0/0"] gateway 10.0.0.1]
How could I select them? I could note the find use the following arguments:
dst-address -- Destination address
prefsrc -- Source address of packets leaving the router
gateway --
check-gateway -- Whether all nexthops of this route are checking reachability of gateway by sending arp requests every 10 seconds
interface -- Interface through which the gateway can be reached
gateway-state -- Shows the status of the next hop
distance -- Administrative distance of the route
scope --
target-scope --
routing-mark -- It's used for policy-routing
from -- item numbers
active --
dynamic --
connect --
static --
rip --
bgp --
ospf --
comment -- short description of the item
disabled --
I can change the routing marked gateways using
/ip route set [/ip route find dst-address="0.0.0.0/0" routing-mark="mark"] gateway 10.0.0.1]
But if I try to change the gateway without routing mark, it doesn't work. I've tried the following without success:
/ip route set [/ip route find dst-address="0.0.0.0/0" routing-mark=""] gateway 10.0.0.2]
/ip route set [/ip route find dst-address="0.0.0.0/0" gateway="192.168.0.1"] gateway 10.0.0.2]
/ip route set [/ip route find dst-address="0.0.0.0/0" interface="ifname"] gateway 10.0.0.2]
How could I solve that? The interface and gateway arguments doesn't work?
William
/ip route set [/ip route find dst-address="0.0.0.0/0"] gateway 10.0.0.1]
How could I select them? I could note the find use the following arguments:
dst-address -- Destination address
prefsrc -- Source address of packets leaving the router
gateway --
check-gateway -- Whether all nexthops of this route are checking reachability of gateway by sending arp requests every 10 seconds
interface -- Interface through which the gateway can be reached
gateway-state -- Shows the status of the next hop
distance -- Administrative distance of the route
scope --
target-scope --
routing-mark -- It's used for policy-routing
from -- item numbers
active --
dynamic --
connect --
static --
rip --
bgp --
ospf --
comment -- short description of the item
disabled --
I can change the routing marked gateways using
/ip route set [/ip route find dst-address="0.0.0.0/0" routing-mark="mark"] gateway 10.0.0.1]
But if I try to change the gateway without routing mark, it doesn't work. I've tried the following without success:
/ip route set [/ip route find dst-address="0.0.0.0/0" routing-mark=""] gateway 10.0.0.2]
/ip route set [/ip route find dst-address="0.0.0.0/0" gateway="192.168.0.1"] gateway 10.0.0.2]
/ip route set [/ip route find dst-address="0.0.0.0/0" interface="ifname"] gateway 10.0.0.2]
How could I solve that? The interface and gateway arguments doesn't work?
William