Blog.gowifi

Blog.gowifi

logos (other)

Logos

Go Wireless NZ

Tuesday, February 4, 2014

MikroTik Dual Gateway Setup


Scenario:
This scenario will show you how to configure a dual WAN setup on a MikroTik RouterBoard. We will configure two subnets, the first 192.168.1.0/24 subnet on ether3 will use ether1 as its WAN port whilst the second subnet 192.168.2.0/24 on ether4 will use ether2 as its WAN port.


Configure the router to accept DNS requests:
/ip dns set allow-remote-requests=yes

Configure your WAN ports for both subnets:
Network 1:
/ip dhcp-client add interface=ether1 add-default-route=yes use-peer-dns=yes use-peer-ntp=yes comment=wan1 disabled=no   
Network 2:
/ip dhcp-client add interface=ether2 add-default-route=yes use-peer-dns=yes use-peer-ntp=yes comment=wan2 disabled=no 

Add an IP Address to ether3 for the local subnet 192.168.1.0/24:
/ip address add address=192.168.1.1/24 comment=network1 interface=ether3 disabled=no

Add an IP Address to ether4 for the local subnet 192.168.2.0/24:
/ip address add address=192.168.2.1/24 comment=network2 interface=ether4 disabled=no

Setup your DHCP servers for both subnets:
Network 1:
[admin@MikroTik] > /ip dhcp-server setup
Select interface to run DHCP server on

dhcp server interface: ether3Select network for DHCP addresses

dhcp address space: 192.168.1.0/24
Select gateway for given network

gateway for dhcp network: 192.168.1.1
Select pool of ip addresses given out by DHCP server

addresses to give out: 192.168.1.2-192.168.1.254
Select DNS servers

dns servers: 192.168.1.1
Select lease time

lease time: 3d 


Network 2:
[admin@MikroTik] > /ip dhcp-server setup
Select interface to run DHCP server on

dhcp server interface: ether4
Select network for DHCP addresses

dhcp address space: 192.168.2.0/24
Select gateway for given network

gateway for dhcp network: 192.168.2.1
Select pool of ip addresses given out by DHCP server

addresses to give out: 192.168.2.2-192.168.2.254
Select DNS servers

dns servers: 192.168.2.1
Select lease time

lease time: 3d

 

Configure your NAT masquerade rules for each Network:
Network 1:
/ip firewall nat add chain=srcnat out-interface=ether1 src-address=192.168.1.0/24 comment="masquerade network1 out ether1" action=masquerade disabled=no

Network 2:
/ip firewall nat add chain=srcnat out-interface=ether2 src-address=192.168.2.0/24 comment="masquerade network2 out ether2" action=masquerade disabled=no


 

5 comments:

  1. awesome tutorial :)
    I've been searching everywhere, but this is the great article I've ever seen :)

    thank you very much sir, I really am thank you <3 hope you do more to create this awesome tutorial, especially about MikroTik :)

    ReplyDelete
    Replies
    1. sir :) is there any way I can manage dual gateway with same network? :)

      e.g

      eth3 with subnet 172.16.0.0 & eth4 172.16.0.0, eth3 > eth1 (as its WAN port) & eth4 > eth2

      but the IP Address for either 3 or 4 is different :)
      /ip address add address=172.16.0.1/24 comment=network1 interface=eth3 disabled=no

      /ip address add address=172.16.0.5/24 comment=network2 interface=eth4 disabled=no

      I still don't know what to do with NAT here :) what src-address="should I use" is it 172.16.0.1 or the "subnet" instead?

      thank you very much before sir :) I really appreciate you, that you still cover this awesome knowledge to us :)

      Delete
    2. You can check this link. Wan1 > Lan1 & Wan2 > Lan2 https://www.youtube.com/watch?v=Ze2c0-wfFnE

      ~Zeek

      Delete