Setup dual ISP access on Mikrotik Router, Firewall

How To setup Multiple ISP Access on Mikrotik Secure way

Use case scenario

We have 2 or mutiple entities with their own different LAN networks and different ISPs to join internet, but only via single router as gateway.

In our example we use Mikrotik router and switch, Please see below network topology for the desgin.


All configuration will be done on the mikrotik router, and we only use 2 ISP access, but you can extend the configuratiuon to multiple ISP access, eg 3 or more.

Set interfaces on the router and asign names on the ports we use:

/interface ethernet
set [ find default-name=ether1 ] name=ETH1-ISP1
set [ find default-name=ether2 ] name=ETH2-LAN1
set [ find default-name=ether3 ] name=ETH3-ISP2
set [ find default-name=ether4 ] name=ETH4-LAN2

/interface list
add name=LAN1
add name=ISP1
add name=LAN2
add name=ISP2

Add IP Pools and it’s IP address ranges:

/ip pool
add name=LAN1-Pool ranges=
add name=LAN2-Pool ranges=

Configure DHCP server for LAN clients:

/ip dhcp-server
add address-pool=LAN1-Pool disabled=no interface=ETH2-LAN1 lease-time=5d \
add address-pool=LAN2-Pool disabled=no interface=ETH4-LAN2 lease-time=5d \

/interface list member
add interface=ETH1-ISP1 list=ISP1
add interface=ETH2-LAN1 list=LAN1
add interface=ETH3-ISP2 list=ISP2
add interface=ETH4-LAN2 list=LAN2

/ip address
add address= interface=ETH2-LAN1 network=
add address= interface=ETH4-LAN2 network=
/ip dhcp-client
add disabled=no interface=ETH1-ISP1
add disabled=no interface=ETH3-ISP2
/ip dhcp-server network
add address= dns-server=, gateway=
add address= dns-server=, gateway=

Add DNS configuration:

/ip dns
set servers=,

Most importent step is to setup firewall on the router:

/ip firewall address-list
add address= comment="Self-Identification [RFC 3330]" list=Bogons
add address= comment="Private[RFC 1918] - CLASS A # Check if you nee\
    d this subnet before enable it" list=Bogons
add address= comment="Loopback [RFC 3330]" list=Bogons
add address= comment="Link Local [RFC 3330]" list=Bogons
add address= comment="Private[RFC 1918] - CLASS B # Check if you \
    need this subnet before enable it" list=Bogons
add address= comment="Reserved - IANA - TestNet1" list=Bogons
add address= comment="6to4 Relay Anycast [RFC 3068]" list=\
add address= comment="NIDB Testing" list=Bogons
add address= comment="Reserved - IANA - TestNet2" list=Bogons
add address= comment="Reserved - IANA - TestNet3" list=Bogons
add address= comment=\
    "MC, Class D, IANA # Check if you need this subnet before enable it" \
/ip firewall filter
add action=accept chain=forward comment="defconf: accept established,related" \
add action=drop chain=forward comment="defconf: drop invalid" \
add action=accept chain=input port=69 protocol=udp
add action=accept chain=forward port=69 protocol=udp
add action=drop chain=forward comment=\
    "defconf:  drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
    connection-state=new in-interface=ETH1-ISP1
add action=drop chain=forward connection-nat-state=!dstnat connection-state=\
    new in-interface=ETH3-ISP2
add action=drop chain=forward comment="Drop to bogon list" dst-address-list=\
add action=accept chain=input protocol=icmp
add action=accept chain=input connection-state=established
add action=accept chain=input connection-state=related
add action=drop chain=input in-interface=ETH1-ISP1
add action=drop chain=input in-interface=ETH3-ISP2

/ip firewall mangle
add action=mark-routing chain=prerouting comment="LAN1 to ISP1" \
    new-routing-mark=LAN1-to-ISP1 passthrough=yes src-address=
add action=mark-routing chain=prerouting comment="LAN2 to ISP2" \
    new-routing-mark=LAN2-to-ISP2 passthrough=yes src-address=

/ip firewall nat
add action=masquerade chain=srcnat out-interface=ETH1-ISP1
add action=masquerade chain=srcnat out-interface=ETH3-ISP2

Last step we need to setup the IP routing to let the LAN side clients to find out their own outbound gateway:

/ip route
add distance=1 gateway= routing-mark=LAN1-to-ISP1 
// is ISP1 address
add distance=1 gateway= routing-mark=LAN2-to-ISP2
// is ISP2 address

/system clock
set time-zone-name=Asia/Almaty

Leave a Reply

Your email address will not be published. Required fields are marked *