Wrong src address

Hello guys.

I’ve an x86 machine running RouterOS 5.20 which acts as a router for 3 networks. There are 5 IP addresses assigned to this router, lets assume they are:

ether1: 203.0.113.46/30
ether2: 192.0.2.1/29
ether3: 192.0.2.9/29
vlan1-ether1: 198.51.100.2/29
eoip-tunnel1: 203.0.113.49/30

I use Mikrotik’s HttpProxy as transparent proxy for all networks. Something strange occurs when I get an error page (e.g. timeout) from Mikrotik’s proxy from a computer in the network attached to ether2 interface for example (the same occurs in other networks). Instead of show proxy’s IP as 192.0.2.1, it does another from other network/interface, e.g. 203.0.113.49.

In this case of proxy it’s just strange, causing no real troubles. But in other cases like restricting access to some network only from a specific source this RouterOS’ behavior is taking out my rest. I restrict network in ether3 to be accessible only from vlan IP range 198.51.100.0/29. When I try to access some resource in ether3’ network I get no sucess. This is because RouterOS is assuming accesses are being done from other IPs rather than these in range I allowed.

The worse (most strange) is what follows. I’ve a user named “local” which is used only by scripts which need to self connect via FTP, for instance. This user has no password and I restrict login using it to 127.0.0.0/8. When my scripts try to login to 127.0.0.1 via FTP using “local” user I get authentication fault. Log shows me the authentication try was done from an IP assigned to any of the interfaces, e.g. 203.0.113.46.

In NAT there are only two rules: an empty masquerade - only chain and action are set, I must allow networks to communicate between them, except those who I filter as said before - and a dst-nat which redirects everything going to port 80 somewhere not self router to Mikrotik HttpProxy.

What is causing this very strange behavior in RouterOS? How can I fix it?
Thanks in advance and sorry if my English writing skill is so poor for you. :wink:

the problem is simple: you masquerade all…
all the traffic passing trougth the router appear from 203.0.113.x

the masquerade MUST be used only from one pool of not public IP address as src-address to out on one wan interface.

Like this:
/ip firewall nat
add action=masquerade chain=srcnat comment=NAT out-interface=pppoe-client src-address=192.168.1.0/24

So will I need to create one masquerade rule for each pair of networks I wanna be able to communicate between themselves?
It isn’t here just networks to Internet, but also networks to networks traffic. Creating one masquerade for each combination of networks (e.g.: 192.0.2.1/29 and 192.0.2.9/29, 192.0.2.1/29 and 198.51.100.2/29…) would result in so much rules.
What workaround do you suggest me to solve this trouble?

Why you need Nat for all networks in the first place?
Can you give some more info about your topology.

You not need any masquerade between LANs!

All the lan can communicate between eachother because dynamic routing rules are present when you assign one IP to one interface.

Wow, really. I forgot this detail, rextended. You can call me dumb.
Thank you rexended and Rudios.

So, the wrong src address problem was due this general masquerade… problem resolved. Thanks!