I am not sure what the problem is here. Right now it looks as if I remove multiple routes to fast after each other, the routing table gets broken.
The result is that the default route gets lost, also the router is no longer accessible via Winbox, even MAC access. After about 10 seconds the router
is accessible again via MAC/IP but the default route is lost. ROS 6.48.3 on a CCR2004.
My current solution is to place a delay of 1 second between the /ip route remove commands.
Is this a known problem or am I doing something wrong?
Thanks for any input
dksoft
Here is my configuration. I configure dhcp-client on an interface and execute a script if the interfaces is bound. On un-bound, the routes get removed.
First configuration fails:
:if ($bound = "0") do= {
/ip firewall mangle set disabled=yes [find comment="HETZNER by DHCP client"]
# PLEASE LOOK HERE
/ip route remove [find comment="HETZNER by DHCP client"]
} else= {
:if ($bound = "1") do= {
/ip firewall mangle set disabled=no [find comment="HETZNER by DHCP client"]
/ip route add dst-address=0.0.0.0/0 gateway=$"gateway-address" pref-src=$"lease-address" routing-mark=HETZNER_rt comment="HETZNER by DHCP client"
/ip route add dst-address=136.x.y.z/28 gateway=HETZNER pref-src=$"lease-address" routing-mark=HETZNER_rt comment="HETZNER by DHCP client"
}
Second configuration (uses a :foreach loop) also fails:
:if ($bound = "0") do= {
/ip firewall mangle set disabled=yes [find comment="HETZNER by DHCP client"]
# PLEASE LOOK HERE
:foreach item in= [/ip route find comment="HETZNER by DHCP client"] do= {
/ip route remove $item
}
} else= {
:if ($bound = "1") do= {
/ip firewall mangle set disabled=no [find comment="HETZNER by DHCP client"]
/ip route add dst-address=0.0.0.0/0 gateway=$"gateway-address" pref-src=$"lease-address" routing-mark=HETZNER_rt comment="HETZNER by DHCP client"
/ip route add dst-address=136.x.y.z/28 gateway=HETZNER pref-src=$"lease-address" routing-mark=HETZNER_rt comment="HETZNER by DHCP client"
}
Third configuration (uses a :foreach loop and delay) works reliable:
:if ($bound = "0") do= {
/ip firewall mangle set disabled=yes [find comment="HETZNER by DHCP client"]
# PLEASE LOOK HERE
:foreach item in= [/ip route find comment="HETZNER by DHCP client"] do= {
/ip route remove $item
:delay 1000ms
}
} else= {
:if ($bound = "1") do= {
/ip firewall mangle set disabled=no [find comment="HETZNER by DHCP client"]
/ip route add dst-address=0.0.0.0/0 gateway=$"gateway-address" pref-src=$"lease-address" routing-mark=HETZNER_rt comment="HETZNER by DHCP client"
/ip route add dst-address=136.x.y.z/28 gateway=HETZNER pref-src=$"lease-address" routing-mark=HETZNER_rt comment="HETZNER by DHCP client"
}