Community discussions

MikroTik App
 
mbrouwer88
just joined
Topic Author
Posts: 1
Joined: Fri Nov 13, 2015 12:37 am

How to Dynamic NAT VLAN over second WAN ip

Fri Nov 13, 2015 12:44 am

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
 
User avatar
pukkita
Trainer
Trainer
Posts: 3051
Joined: Wed Dec 04, 2013 11:09 am
Location: Spain

Re: How to Dynamic NAT VLAN over second WAN ip

Fri Nov 13, 2015 6:02 pm

Have a look at http://mum.mikrotik.com/presentations/US12/tomas.pdf

what you're looking after is load balancing. (If you do have two WAN lines)
Last edited by pukkita on Fri Nov 13, 2015 10:35 pm, edited 1 time in total.
 
User avatar
tslytsly
Frequent Visitor
Frequent Visitor
Posts: 65
Joined: Tue Oct 27, 2015 6:52 pm
Location: Nottingham
Contact:

Re: How to Dynamic NAT VLAN over second WAN ip

Fri Nov 13, 2015 6:16 pm

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