These networks need to be masqueraded to public IP addresses assigned to a single port of Mikrotik with different VLAN IDs.
I have two different VLANs (100 and 200) for the masquerading.
IP address xx.xx.xx.aa , xx.xx.xx.bb, xx.xx.xx.cc belong to VLAN 100.
IP address yy.yy.yy.aa belongs to VLAN 200.
Please help me so that I can achieve the following:
Network 172.16.1.0/24, 172.16.2.0/24 and 172.16.3.0/24 should be masqueraded to VLAN 100 (IP: xx.xx.xx.aa, xx.xx.xx.bb, xx.xx.xx.cc respectively) in order to access the internet.
Network 172.16.4.0/24 should be masqueraded to VLAN 200 (IP: yy.yy.yy.aa) in order to access the internet.
Specify an out interface with the NAT rule. Also make sure you mark for routing in the mangle chain so the router knows what route to use when forwarding the traffic.
Here is one method to go about it. Basically you are defining an address list for use in Mangle to determine what link you want connections to go out of. Then in NAT you are specifying what IP address you want connections to be NATed out of. In Mangle you are marking connections inside of the router so it knows what route to use when forwarding the traffic, and you are making sure you have the appropriate routing mark in your tables. This is basically policy based routing, and there are likely a few other ways to go about it too.