two ip addresses on the same subnet on a single interface

Sveiki !

I have two ip addresses on the same subnet on a single external interface (wan). for example 1.1.1.1/24 & 1.1.1.2/24, default gw 1.1.1.254. local network 192.168.0.0/24.
I want from address 192.168.0.1 to address 77.72.80.15 use second external ip address 1.1.1.2

nat:
/ip firewall nat add action=masquerade chain=srcnat out-interface=wan

rounting mark:
/ip firewall mangle add action=mark-routing chain=prerouting dst-address=77.72.80.15 new-routing-mark=r2 src-address=192.168.0.1

routing:
/ip route
add distance=1 gateway=1.1.1.254 pref-src=1.1.1.1 routing-mark=r1
add distance=1 gateway=1.1.1.254 pref-src=1.1.1.2 routing-mark=r2
add distance=2 gateway=1.1.1.254

but, always use default address 1.1.1.1

what am I doing wrong ?

RB model?
ROS Version?
/export compact?

192.168.0.1 is internal address, or is address of?


Try use only this:

/ip route
add distance=1 gateway=1.1.1.254 pref-src=1.1.1.1
add distance=1 gateway=1.1.1.254 pref-src=1.1.1.2 routing-mark=r2

Not work.

ROS 6.10, 192.168.0.1 is internal address, configuration is too large and not for all.

Obviously not all the config but only the interested parts, like you miss /ip adress and others.

The answer is not too educated and my help is not for all.

Someone else will help you.

Perhaps what you really want isn’t routing marks, but rather just this rule before your current masquerade rule:
/ip firewall nat
add action=src-nat chain=srcnat dst-address=77.72.80.15 src-address=192.168.0.1 to-addresses=1.1.1.2

this is not work.

Well, “this is not work” is not very helpful. Try to be more specific. If you put this new rule before your original masquerade rule, there’s no reason why it wouldn’t catch matching packets (src-address=192.168.0.1 dst-address=77.72.80.15) and rewrite their source to 1.1.1.2 (if I understood you correctly, that’s what you want). Unless there’s some other earlier rule preventing that. Or it can be influenced by some other, e.g. filter rules. So it also depends on how exactly you test it and what you see, what exactly does not work as you expect.