Routing question (mask outgoing ip?)

Hi,

Sorry for the wrong terminology, but I’m not sure which terms I must use to describe my problem.

I want to separate my internal network in 2 groups. This was easy with mangle.
Both groups use the same gateway (192.168.0.1), but each group must be “visible” by the gateway with 1 seperate IP.

This means:

GROUP A → I want all the connections from this group to be masked in the ip 192.168.0.253
GROUP B → I want all the connections from this group to be masked in the ip 192.168.0.254

Any help would be highly appreciated

Do you mean you want to NAT two groups of clients to different IPs?

Why do you want to NAT them to an IP address on the same network?

Hi , thanks for your answer.

My Gateway router can manage different connections rights by the incoming ip only. So the only way to do it is to “mask” its group to an IP.
So for example a client which belongs to GROUP A must be shown as 192.168.0.253 to the gateway router and a client from Group B must be shown as 192.168.0.254 to the gateway router

What addresses would the clients in groups A and B be using?

Group A has 192.168.50.x
Group B has 192.168.60.x

So you are talking about NAT?

Something like:

/ip nat
add chain=srcnat src-address=192.160.50.0/24 action=src-nat to-address=192.168.0.253
add chain=srcnat src-address=192.160.60.0/24 action=src-nat to-address=192.168.0.254

Hi, thank you very much, it worked just fine.

In the meantime I found another solution that “should” work (but it didn’t). i tried to set the preferred source in routing. Is this wrong?

yep. ‘pref. src’ is for different goals