Hi,
I configured my Mikrotik routerboard like this:
- WAN interface has 2 public IP's, lets say 1.1.1.1 and 1.1.1.2
- I use two VLANs with two subnets, let says VLAN 10 = 172.16.10.0/24 and VLAN 20 = 172.16.20.0/24
I want to configure dynamic nat (i guess that is masquerade) like this:
VLAN10 internet traffic goes via public IP 1.1.1.1
VLAN20 internet traffic goes via public IP 1.1.1.2
How to configure this? I can only set source port/dest port, not IP address.
Please help.
Greets, Marco
Hi Marco,
This is relatively straight forward.
It looks like you have multiple IPs on the same WAN connection. (I say this because 1.1.1.1 and 1.1.1.2 are in the same subnet and so must be on the same connection)
What you want to achieve is to have different source NAT for each private VLAN.
You just need these 2 rules:
ip firewall nat
add chain=srcnat action=src-nat to-addresses=1.1.1.1 src-address=172.16.10.0/24 out-interface=ether1-gateway comment="Masquerade VLAN10 as 1.1.1.1"
add chain=srcnat action=src-nat to-addresses=1.1.1.2 src-address=172.16.20.0/24 out-interface=ether1-gateway comment="Masquerade VLAN20 as 1.1.1.2"
Obviously you need to modify the IPs and interface with your details but that's the gist of it.
Tom