Routing-mark on Output chain not working *SOLVED*

Hi

I seem to have a problem with route mark on outgoing traffic from the RouterOS device.
Version used is ROS 3.6

If I do the following:

/ip route> add dst-address=192.168.0.0/24 gateway=10.0.0.1 routing-mark=test
/ip route rule> add routing-mark=test action=lookup table=test
/ip firewall mangle> add action=mark-routing chain=output disabled=no new-routing-mark=test src-address=10.0.2.1

(and don’t have any default route in the main routing table). I get the following:

/ping 192.168.0.1 src-address=10.0.2.1
no route to host
no route to host

which means it doesn’t look in the test routing table where I added the route but in the main routing table where there isn’t any route for that network. Is there any way to solve this problem?


With hope for help,
Hippo

delete the lookup rule i route table, mangle rule for routing does what’s needed, and and table lookup just messes things, remmber to reboot after that, i had the same situation i removed route lookup and rebooted and it started to working. Also if you have multiple ips, and you want to start connection from the router (because normal situation is when you have multiple ips and for it a routing mark, when you ping that ip from other device then this rule will work) besides that marking rule for src-address you need a netmap/srcnat rule that will make sure that all connections from this router will be nated to this specific address (you can src-address-type=local for that)

cheers
Michal

Hi!

Thanks for the help!

Allthough there was one more thing missing, you have to have a route for the network in the 192.168.0.0/24 in the main table. That route wasn’t used but unless it was there it would not check the alternative routing table for a route for that network. I noticed this I didn’t have any default route in the default routing table.

br
Hippo

you have right i didn’t notice it before but yes if you don’t have route in main table even if it’s pointing on strange gateway, system won’t check alternate routing tables.

Thanks for clarifyin

Cheers