Routing Help !!!

I am a New Microtik User, a friend of mine recently introduced me to Microtik. I downloaded the trial v6.0rc6 and have installed it on a pc with four 100 Mbps Lan Cards. It’s a testing phase.

The scenario is I have two Internet connection and they are as follows :-

WAN1
IP : 113.20.16.23
SUBNET : 255.255.255.240
Gateway : 113.20.16.20
DNS : 113.20.16.1, 113.20.16.2

WAN2
IP : 227.30.32.34
SUBNET : 255.255.255.240
Gateway : 227.30.32.30
DNS : 227.30.32.1, 227.30.32.2

I also have two LAN Networks.
Lan1 - 192.168.1.0 Network
IP : 192.168.1.1
Subnet : 255.255.255.0

Lan2
IP : 172.16.1.1
Subnet : 255.255.255.0

I want to Route Lan1 Via Wan1 and Lan2 Via Wan2.

Please help me how can I accomplish this. I have only learnt few basic commands. I don’t want to go in depth. I would just want this scenario to be working. Your help will be highly appreciated.

you want to nat this.. not route.. i suppose.


make a cople of firewall rute. src-nat action mascurade. src-address- the net you want to nat, out Interface - the wan Interface you want to use.

If you really just want to route (no NAT & no firewall) then you could place the WAN/LAN interfaces in 2 different VRFs (In IP / Route). Make 2 VRF entries and assign one WAN & LAN to each. Those interfaces will then only see routing entries for the other interfaces in their VRFs.

That is a simple method - there are plenty of more complicated ways which offer additional features.

Yes use nat for both wan’s
Go to “ip” then “firewall” then “nat”
Both masquerade as action
nat1.jpg
nat2.jpg
nat3.jpg

You don’t need NAT. All you need is 2 mangle rules for prerouting and 2 static routing rules for routing to 0.0.0.0/0 as described here: http://wiki.mikrotik.com/wiki/Load_Balancing_over_Multiple_Gateways

I don’t need load balancing that is not my requirement, after a long search I came to know about policy routing, I tried several examples but I can’t make it work.

My requirement is that I have two ISP Connections

ISP 1 IP Address : 10.0.0.2
ISP 1 Gateway : 10.0.0.1

ISP 2 IP Address : 10.0.1.2
ISP 2 Gateway : 10.0.1.1

LAN 1 IP Address : 172.16.1.1
LAN 2 IP Address : 192.168.1.1

I need to route LAN1 Via ISP 1 and LAN2 Via ISP2

I don’t need load balancing.

I have four different Ethernet cards installed and they are named as

LAN1 : 172.16.1.1
LAN2 : 192.168.1.1
WAN1 : 10.0.0.2
WAN2 : 10.0.1.2

Please help me, I tried several times and went through many tutorials but none worked for my requirement.

I hope this will be work for you

/ip route
add dst-address=0.0.0.0/0 gateway=113.20.16.20 routing-mark=to_wan1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=227.30.32.30 routing-mark=to_wan2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=172.16.1.1 distance=2 check-gateway=ping

/ip firewall nat
add action=masquerade chain=srcnat disabled=no out-interface=wan1 src-address=192.168.1.0/24
add action=masquerade chain=srcnat disabled=no out-interface=wan2 src-address= 172.16.1.0/24

/ip firewall mangle
add chain=input in-interface=wan1 action=mark-connection new-connection-mark=wan1_conn
add chain=input in-interface=wan2 action=mark-connection new-connection-mark=wan2_conn
add chain=output connection-mark=wan1_conn action=mark-routing new-routing-mark=to_wan1
add chain=output connection-mark=wan2_conn action=mark-routing new-routing-mark=to_wan2