Someone wrote that to me before, so I thought “oops, stupid me”, but then I tested it and it worked like I thought before. I tried it again now:
/ip address
add address=10.100.222.2/24 interface=test2 network=10.100.222.0
add address=10.100.222.3/24 interface=test2 network=10.100.222.0
add address=10.100.222.4/24 interface=test2 network=10.100.222.0
/ip firewall nat
add action=src-nat chain=srcnat log=yes out-interface=test2 to-addresses=10.100.222.3
add action=masquerade chain=srcnat log=yes out-interface=test2
/ip firewall mangle
add action=log chain=postrouting out-interface=test2
This is with src-nat rule disabled, to test masquerade:
14:31:43 firewall,info postrouting: in:(none) out:test2, src-mac 00:0c:29:d6:66:05, proto TCP (SYN), 192.168.80.180:45097->159.148.147.201:80, len 60
14:31:43 firewall,info srcnat: in:(none) out:test2, src-mac 00:0c:29:d6:66:05, proto TCP (SYN), 192.168.80.180:45097->159.148.147.201:80, len 60
14:31:43 firewall,info postrouting: in:(none) out:test2, src-mac 00:0c:29:d6:66:05, proto TCP (ACK), 192.168.80.180:45097->159.148.147.201:80, NAT (192.168.80.180:45097->> 10.100.222.2> :45097)->159.148.147.201:80, len 52
And now the real thing with both src-nat and masquerade enabled:
14:33:05 firewall,info postrouting: in:(none) out:test2, src-mac 00:0c:29:d6:66:05, proto TCP (SYN), 192.168.80.180:45105->159.148.147.201:80, len 60
14:33:05 firewall,info srcnat: in:(none) out:test2, src-mac 00:0c:29:d6:66:05, proto TCP (SYN), 192.168.80.180:45105->159.148.147.201:80, len 60
14:33:05 firewall,info postrouting: in:(none) out:test2, src-mac 00:0c:29:d6:66:05, proto TCP (ACK), 192.168.80.180:45105->159.148.147.201:80, NAT (192.168.80.180:45105->> 10.100.222.3> :45105)->159.148.147.201:80, len 52
It uses correct address and counter for masquerade does not increment. You say that masquerade rule should win, OP claims that removing it helped, plus another one from before, … but not here. Any ideas?