MikroTik Dual WAN over 2 DHCP Internet Connections

Sdílet
Vložit
  • čas přidán 28. 05. 2020
  • /interface ethernet
    set [ find default-name=ether1 ] name=ether1-WAN1
    set [ find default-name=ether2 ] name=ether2-WAN2
    set [ find default-name=ether4 ] name=ether4-LAN
    /ip pool
    add name=dhcp_pool0 ranges=10.10.10.2-10.10.10.254
    /ip dhcp-server
    add address-pool=dhcp_pool0 disabled=no interface=ether4-LAN name=dhcp1
    /ip address
    add address=10.10.10.1/24 interface=ether4-LAN network=10.10.10.0
    /ip dhcp-client
    add add-default-route=no disabled=no interface=ether1-WAN1 script="{
    \

    :local rmark \"to_wan1\"
    \

    :local count [/ip route print count-only where comment=\"to_wan1\"]\

    \

    :if (\$bound=1) do={
    \

    :if (\$count = 0) do={
    \

    /ip route add distance=1 gateway=\$\"gateway-address\" check\
    -gateway=ping routing-mark=to_wan1 comment=\"to_wan1\"
    \

    /ip route add distance=1 gateway=\$\"gateway-address\" check\
    -gateway=ping comment=\"to_wan1\"
    \

    } else={
    \

    :if (\$count = 1) do={
    \

    :local test [/ip route find where comment=\"to_wan1\"]
    \

    :if ([/ip route get \$test gateway] != \$\"gateway-addre\
    ss\") do={
    \

    /ip route set \$test gateway=\$\"gateway-address\"
    \

    }
    \

    } else={
    \

    :error \"Multiple routes found\"
    \

    }
    \

    }
    \

    } else={
    \

    /ip route remove [find comment=\"to_wan1\"]
    \

    }
    \

    }"
    add add-default-route=no disabled=no interface=ether2-WAN2 script="{
    \

    :local rmark \"to_wan2\"
    \

    :local count [/ip route print count-only where comment=\"to_wan2\"]\

    \

    :if (\$bound=1) do={
    \

    :if (\$count = 0) do={
    \

    /ip route add distance=1 gateway=\$\"gateway-address\" check\
    -gateway=ping routing-mark=to_wan2 comment=\"to_wan2\"
    \

    /ip route add distance=2 gateway=\$\"gateway-address\" check\
    -gateway=ping comment=\"to_wan2\"
    \

    \t} else={
    \

    :if (\$count = 1) do={
    \

    :local test [/ip route find where comment=\"to_wan2\"]
    \

    :if ([/ip route get \$test gateway] != \$\"gateway-addre\
    ss\") do={
    \

    /ip route set \$test gateway=\$\"gateway-address\"
    \

    }
    \

    } else={
    \

    :error \"Multiple routes found\"
    \

    }
    \

    }
    \

    } else={
    \

    /ip route remove [find comment=\"to_wan2\"]
    \

    }
    \

    }"
    /ip dhcp-server network
    add address=10.10.10.0/24 dns-server=8.8.8.8 gateway=10.10.10.1
    /ip firewall mangle
    add action=accept chain=prerouting in-interface=ether1-WAN1
    add action=accept chain=prerouting in-interface=ether2-WAN2
    add action=mark-connection chain=prerouting dst-address-type=!local \
    new-connection-mark=wan1_conn passthrough=yes per-connection-classifier=\
    both-addresses-and-ports:2/0 src-address=10.10.10.0/24
    add action=mark-connection chain=prerouting dst-address-type=!local \
    new-connection-mark=wan2_conn passthrough=yes per-connection-classifier=\
    both-addresses-and-ports:2/1 src-address=10.10.10.0/24
    add action=mark-routing chain=prerouting connection-mark=wan1_conn \
    new-routing-mark=to_wan1 passthrough=yes src-address=10.10.10.0/24
    add action=mark-routing chain=prerouting connection-mark=wan2_conn \
    new-routing-mark=to_wan2 passthrough=yes src-address=10.10.10.0/24
    /ip firewall nat
    add action=masquerade chain=srcnat out-interface=ether1-WAN1 src-address=\
    10.10.10.0/24
    add action=masquerade chain=srcnat out-interface=ether2-WAN2 src-address=\
    10.10.10.0/24
    /ip route
    add check-gateway=ping comment=to_wan1 distance=1 gateway=192.168.1.1 \
    routing-mark=to_wan1
    add check-gateway=ping comment=to_wan2 distance=1 gateway=192.168.2.1 \
    routing-mark=to_wan2
    add check-gateway=ping comment=to_wan1 distance=1 gateway=192.168.1.1
    add check-gateway=ping comment=to_wan2 distance=2 gateway=192.168.2.1
  • Věda a technologie

Komentáře • 334

  • @matthewfranck5458
    @matthewfranck5458 Před 3 lety +1

    This is amazing!! Thank you so much for this!!

  • @jean-francoishetu6147
    @jean-francoishetu6147 Před 5 měsíci

    Could you confirm my understanding... if we don't complete the configuration with the mangle rules and simply keep the DHCP client configuration. Then this becomes a simple Dual WAN DHCP client failover solution?
    ie: the mangle portion allows for load balancing, correct?

  • @mikey_2387
    @mikey_2387 Před 3 lety +1

    Is it possibleto have 3 isp. 2 isp is for bonding/browsing and the other one is for gaming purposes only?

  • @joelram3182
    @joelram3182 Před 3 lety

    i tried the dual wan static and it was perfect.. thank you for that also

  • @dexturevlogs5677
    @dexturevlogs5677 Před 2 lety

    Hello, I hope i can receive a response for this. I used this configuration and its work totally fine for my dual wan set-up, however, i can't ping to the networks i created on LAN3 and LAN4 vice versa. Given the fact that, that LAN1 AND LAN2 is for ISP. Any suggestion how my networks could ping each other.

  • @arodb86
    @arodb86 Před 3 lety

    Hello, what should I do in order to activate WLAN ( WIFI) using the same Balanced LAN..??? Thanks

  • @Elrevisor2k
    @Elrevisor2k Před 3 lety +1

    thanks for sharing if I want also do this for wireless what I need to do as I see only one port Lan is enabled but for the 2g and 5g wireless to happen what I need to do?

    • @wifilabxyz
      @wifilabxyz  Před 3 lety +1

      create a bridge, make this bridge as your LAN. add wifi and port interfaces to it.

  • @waldenlaab4285
    @waldenlaab4285 Před 3 lety

    Sir what will happened when two isp dhcp meet in load banlancer ?
    And meet static and dhcp in load banlancer?

  • @ilyasft9640
    @ilyasft9640 Před 2 lety

    Thank you for this video!
    i'm successfully join both my WAN connection.
    if i can ask 1 question, how do i force certain IP Address/client to use only WAN1 ?
    i tried using source address != "Block to WAN2" but the client still using both WAN connection

  • @zbgslavi
    @zbgslavi Před 3 lety +4

    The scripts will not work correctly, if the DHCP server just change the gateway. It will go to the :error "Multiple routes found'. I suggest better script. When you apply it to the WAN2 DHCP client, just change the first line.
    {
    :local rmark "to_wan1"
    :if ($bound=1) do={
    :if ([/ip route print count-only where comment=$rmark] = 0) do={
    /ip route add distance=1 gateway=$"gateway-address" check-gateway=ping routing-mark=$rmark comment=$rmark
    /ip route add distance=1 gateway=$"gateway-address" check-gateway=ping comment=$rmark
    } else={
    :foreach r in=[/ip route find where comment=$rmark] do={
    :if ([/ip route get $r gateway] != $"gateway-address") do={
    /ip route set $r gateway=$"gateway-address"
    }
    }
    }
    } else={
    /ip route remove [find comment=$rmark]
    }
    }

  • @wncgcg
    @wncgcg Před 2 lety +1

    @wifiLAB, excuse my ignorance, but where should i paste the script provided? I'm a newbie!!!

    • @wifilabxyz
      @wifilabxyz  Před 2 lety +1

      from the terminal...

    • @wncgcg
      @wncgcg Před 2 lety +1

      @@wifilabxyz thanks so much for replying back at me!!

  • @EraseAllDrives
    @EraseAllDrives Před 2 lety

    @wifiLAB, hello, how to make your script work with l2tp providers?

  • @TechnicalMamunBengali
    @TechnicalMamunBengali Před 3 lety

    (ether1=pppoe-client)+(ovpn -client/l2tp-client/sstp-client/pptp-client) = (ether 2=dhcp)
    where vpn connection will only be used for block site to open.
    bro how can i do that??
    i need your help .

  • @lightbeam6783
    @lightbeam6783 Před 3 lety +1

    Hello there. I have followed the instructions on this video to the T and i'm not getting internet breakout on the mikrotik when the wan is connected to either wan1 or wan 2 - getting no route to host error? Please can you give more information on the ip/route setup?

    • @wifilabxyz
      @wifilabxyz  Před 3 lety

      maybe u have missed something. please try the script posted in the description.

    • @lightbeam6783
      @lightbeam6783 Před 3 lety +1

      @@wifilabxyz Thank you so much for the reply. I started everything form scratch and it is now working just as it should. You are probably right , my bad :)

  • @metalstream
    @metalstream Před 3 lety +3

    Great tutorial bro, still i dont get why we must send you an email for the scripts when you can just copy&paste on the description...

  • @jez1357
    @jez1357 Před 4 lety +1

    maraming salamat sir ung config nito ung gusto talga salamat sir

  • @sohrkim
    @sohrkim Před 3 lety +1

    impressive!

  • @rk12450
    @rk12450 Před 2 lety

    Dear Team,
    Pls help me for This rules is i ussing
    But the banking site reirect not not login issue

  • @cristianbarboza6298
    @cristianbarboza6298 Před 2 lety

    Como puedo hacer para que sume los 2 anchos de banda??

  • @TechnicalMamunBengali
    @TechnicalMamunBengali Před 3 lety

    or a list of websites will be passing through over vpn while user hit these websites

  • @jvsbm
    @jvsbm Před 2 lety

    Parabéns e muito obrigado top da mais

  • @jez1357
    @jez1357 Před 4 lety

    advance tanks sir

  • @MitzaelSerna
    @MitzaelSerna Před 3 lety +1

    I used Bridge to share the DHCP Server to ether3 and ether4 (3 for WLAN and 4 for LAN)

  • @newtonmuuo1659
    @newtonmuuo1659 Před 2 lety

    HI the script is not adding routes automatically kindly help

  • @3l_96
    @3l_96 Před 3 lety

    Thank you bro 😎

  • @wilsonjuance3760
    @wilsonjuance3760 Před 4 lety +2

    Sna next po 2 mikrotik nmn
    Mt 1 multi isp.
    Mt 2 . Bandwidth mgmt , hs and ppoe

  • @bulitobayagbag6683
    @bulitobayagbag6683 Před 4 lety

    sir how to create packet marks using this routing setup po?
    di ko kasi mapagana yung sakin pwede po pa turo kahit isang set of mangle lang. example is Streaming. how can I create packet marks para magamit po sa Q3
    Thanks sir.

  • @baradotvfunents4979
    @baradotvfunents4979 Před 4 lety +1

    thanks

  • @jez1357
    @jez1357 Před 4 lety +1

    ito ung pinaka clear tuts.... sir baka full scrip ka sir baka pwde maki share

  • @johnrolansunido4626
    @johnrolansunido4626 Před 4 lety

    Sir parang sa tutorial mo pag nakatangal lng yung cable ska ngfafailover pano kung nkasaksak pa din sa router tpos internet lng ang wala.

    • @wifilabxyz
      @wifilabxyz  Před 4 lety

      gawa po kayo script para mamonitor ung internet connection or try netwatch.

  • @sanfrancamotes7530
    @sanfrancamotes7530 Před 3 lety +1

    The configuration for MT rb4011?

  • @psywareSSL
    @psywareSSL Před 9 měsíci

    Thanx for the tutorial but does not work on any of my MTK´s in 7.11 router OS...could u send me the scripts to my mail?
    best regards

  • @notsoordinary8731
    @notsoordinary8731 Před 3 lety

    Paano if same 192.168.1.1 binibigay sa dhcp client

  • @nachorepara
    @nachorepara Před rokem

    hi! great video! but, i cannot make to work the script, when i create the dhcp-client and put the script, it doesn`t create the statics routes. I put it excactly like the description on your video, copy-paste in the terminal, but wont work. I do some modifications to it, but same results, it take some IP from my ISP but nothing happend on the statics routes. Maybe it is wrong? Is ther a way to debug it? Thnks for your help!

    • @tekniqal2639
      @tekniqal2639 Před rokem

      Same here. Followed the tutorial to the letter but the default routes do not show up as shown in the video. I guess the maker of the video has moved on.

    • @nachorepara
      @nachorepara Před rokem

      @@tekniqal2639 hey! I resolved it downgrading My mktk to last versión 6 (i had versión 7) i supose script doesn't work in 7.

    • @tekniqal2639
      @tekniqal2639 Před rokem

      @@nachorepara You know I thought of that but I was thinking of using the containers feature and it only only works with 7. No wireguard with 6 also. What is the latest version of 6 that can be used. Or at least, what version number are you using?

    • @nachorepara
      @nachorepara Před rokem

      I have now 6.48.6 ando it works fine! You should try it, or i think you must search some script for 7.x.x

    • @tekniqal2639
      @tekniqal2639 Před rokem +1

      @@nachorepara Thanks dude. I did look at another guide (see here: czcams.com/video/IsJlBqpVgGo/video.html). He is on 7 but I do not think it really works. He uses the main table and when I turn that off setup stops working which suggests the configuration is not really doing anything. Anyhow, thanks again.

  • @BenzkyG101
    @BenzkyG101 Před 3 lety +1

    Is this merging dual isp boss?

    • @wifilabxyz
      @wifilabxyz  Před 3 lety

      nope, it just balances the traffic from 2 different ISPs.

  • @salemoraya1398
    @salemoraya1398 Před 4 lety +1

    thanks..

  • @ZindelLeander
    @ZindelLeander Před 3 lety +1

    Boss pwede ba ito kung pareho PLDT Home Fibr yung ISP1 and ISP2 ko?

  • @calotcalot
    @calotcalot Před 3 lety +1

    Hi sir is there any chance that we cna check ping 8.8.8.8? Since most outages WAN gateway(ISP modem) is still reacheable unless it its hardware/power related. Thank you. This is very helpful

    • @wifilabxyz
      @wifilabxyz  Před 3 lety

      u can try netwatch or recursive route (i think i have this in 3WAN static video)

  • @enoypinedo6274
    @enoypinedo6274 Před 3 lety

    muchas gracias... estoy usando dos WAN de 10M, está funcionando muy bien... estoy usando Bridge, y detalles en IP Routes..

    • @MitzaelSerna
      @MitzaelSerna Před 3 lety

      fijate que yo tambien tuve que usar Bridge para repartir el DHCP Server entre ether3 y 4

    • @cristianbarboza6298
      @cristianbarboza6298 Před 2 lety

      consulta: Te sumo los 2 enlaces? porque yo no logro hacerlo

  • @MitzaelSerna
    @MitzaelSerna Před 3 lety +1

    the scripts has some extra characters from the parser, should be like this
    {
    :local rmark "to_wan2"
    :local count [/ip route print count-only where comment="to_wan2"]
    :if ($bound=1) do={
    :if ($count = 0) do={
    /ip route add distance=1 gateway=$"gateway-address" check-gateway=ping routing-mark=to_wan2 comment="to_wan2"
    /ip route add distance=1 gateway=$"gateway-address" check-gateway=ping comment="to_wan2"
    } else={
    :if ($count = 1) do={
    :local test [/ip route find where comment="to_wan2"]
    :if ([/ip route get $test gateway] != $"gateway-address") do={
    /ip route set $test gateway=$"gateway-address"
    }
    } else={
    :error "Multiple routes found"
    }
    }
    } else={
    /ip route remove [find comment="to_wan2"]
    }
    }
    only changes wan2 for wan1, the logic of the script are the same

    • @lucianodisarno4328
      @lucianodisarno4328 Před 2 lety

      There is an error here i believe... The second ip route should add a distance = 2...

  • @mehebubbinahmed1036
    @mehebubbinahmed1036 Před 3 lety

    Please make a tutorial 1pppoe+1dhcp
    Load balancing and failover

  • @ArcTour292
    @ArcTour292 Před 3 lety +2

    Thank you for this video. I've been seeking for solution setting up mikrotik with 2 WAN both DHCP-client. Your script is good, but I think there is some mistake in it - in section :if (count=1) we need to write count=2, 'cause we recently created 2 routes in upper section. But I may be wrong. Best regards!

    • @tradethatask7518
      @tradethatask7518 Před 3 lety

      Did you get a reply back on this. I can't get it to auto create the comments and default route using the script.

    • @wifilabxyz
      @wifilabxyz  Před 3 lety

      It's in the description...

  • @tradethatask7518
    @tradethatask7518 Před 3 lety

    I can't get it to auto create the "to_WAN1" comments under routes and also auto create the default route using the script and followed this closely. Any suggestions?

    • @tradethatask7518
      @tradethatask7518 Před 3 lety

      I have an RB2011UiAS and version 6.43. I'm testing with a single ISP and when I connect, it creates the subnet route but not 0.0.0.0/0 default route and also does not insert the comment "to_wan1" etc. Any advice would be helpful to troubleshoot - jason@jakadas.com and jason.bawcom@gmail.com.

    • @tradethatask7518
      @tradethatask7518 Před 3 lety

      Nevermind. I found the issue with a ")" vs. a "}" in one place. Once I addressed this, it worked fine. Thank you!

  • @renzorioja1964
    @renzorioja1964 Před 3 lety +1

    sir bkt parang nka limit lang po sa 30mbps ang wan2 ? thankyu sir

  • @badburn
    @badburn Před 3 lety +1

    nice tutorial. Sir, saan po galing yung 192.168.1.1 at 192.168.2.1 na gateway? thanks

    • @wifilabxyz
      @wifilabxyz  Před 3 lety +1

      yan po ung dalawang router na nakakonek sa mikrotik. 1 isp router = 1.1 at 2 isp router = 2.1

    • @badburn
      @badburn Před 3 lety

      @@wifilabxyz Thank you Sir. Did copy and pasted the script on the Mikrotik terminal. The mikrotik router can ping google.com via terminal but the laptop can't ping google.com. will check again.

  • @raivillegas7242
    @raivillegas7242 Před 4 lety

    Sir from this set up then saksak ko to to another MT na may confi for pisowifi swak ba to?

  • @fearmtechwireless6145
    @fearmtechwireless6145 Před 2 lety

    Hello Good day

  • @reparacionytecnologiaparat2582

    hola gran video podra apoyarme con los script
    saludos y gracias

  • @norwhyndavesales3482
    @norwhyndavesales3482 Před 3 lety +1

    ano main wan ip na gagamitin ng setup na to boss?

    • @wifilabxyz
      @wifilabxyz  Před 3 lety

      main wan ip ng alin sir?

    • @norwhyndavesales3482
      @norwhyndavesales3482 Před 3 lety +1

      yung public IP na gagamitin nia boss, sa ISP 1 ba or ISP 2. para sana sa ip whitelisting just incase.

    • @wifilabxyz
      @wifilabxyz  Před 3 lety +1

      most of the time ung isp 1 sir.

  • @solrista664
    @solrista664 Před rokem

    pleasedo tutorial on dual wan + failover on mikrotik v7

  • @Alescaramanzia
    @Alescaramanzia Před 2 lety

    Thanks a lot, this works!!!

  • @akeemarcayera
    @akeemarcayera Před 3 lety

    Boss thank you!! Gumana yung code!!
    Tanong ko lang din sana if sang banda mag eedit if gusto ko iactivate yung dalawang ports plus yung wifi. Salamat ng marami! God bless!!

    • @wifilabxyz
      @wifilabxyz  Před 3 lety

      gawa ka ng bridge, tapos add mo ung dalawang port at wireless dun sa ginawa mong bridge.

    • @thenomadtrade
      @thenomadtrade Před 3 lety

      @@wifilabxyz pwede ba kitang i add sa facebook sir?

    • @zwack2097
      @zwack2097 Před rokem

      ​@@wifilabxyz bakit po wlang kang ginawang bridge sa video?

  • @choitoi67
    @choitoi67 Před 3 lety

    pwede ba to lagyan ng anti lag sir ?

  • @jenrichonlineshop1712
    @jenrichonlineshop1712 Před 4 lety

    Ito bossing kailangan ko..salamat

  • @TechnicalMamunBengali
    @TechnicalMamunBengali Před 3 lety

    bro i have copied that dhcp code from your video by typing in notepad.

  • @redcat483
    @redcat483 Před 4 lety

    Nice. Pwede po makahingi ng Script? Thanks

  • @FAST-TECH0101
    @FAST-TECH0101 Před 4 lety

    please add 4wan dhcp configuration MikroTik

  • @BunalmananapTV
    @BunalmananapTV Před 3 lety +1

    Pa share nmn scrip sir

  • @kaungmonsoe5020
    @kaungmonsoe5020 Před 4 lety

    Please Can I get your Script..

  • @warfaachannel2013
    @warfaachannel2013 Před 3 lety

    Please help me bro

  • @AlbertTafilaj
    @AlbertTafilaj Před 2 lety

    Anyone managed to get this working on OS 7.1?

  • @jez1357
    @jez1357 Před 4 lety +1

    sir baka pwde na ako makahingi ng script nito cardinalajc19@gmail.com maraming salamat po sana mapansin nyo po ako

  • @michaelmacandog4914
    @michaelmacandog4914 Před 4 lety +1

    pa try po sir penge po ng script kenmichael05@gmail.com salamat po sir

  • @aotsimp4
    @aotsimp4 Před 4 lety +1

    pa send din script for dhcp sir...
    dino.johnson05@gmail.com
    salamat at godbless!

  • @clydedrexler9431
    @clydedrexler9431 Před 4 lety +1

    pasend din po ng script @ drexlerguapo12@gmail.com thank you po

  • @paulpagcaliwangan5137
    @paulpagcaliwangan5137 Před 4 lety +1

    pwede po makahingi script. paulpagcaliwangan@gmail.com salamat

  • @dyyoung7573
    @dyyoung7573 Před 4 lety +1

    Pa send din po script salamat po.
    dyyoung1028@gmail.com

  • @JyCny
    @JyCny Před 4 lety +1

    pa send po script newbie lang po salamat ^_^. canoyarnulfop@gmail.com

  • @abelyap4666
    @abelyap4666 Před 3 lety +1

    sir p send poh ng script kenkerby40@gmail.com

  • @MrRenz15
    @MrRenz15 Před 4 lety +1

    sir pa send po ng script brezr15@gmail.com thankyou po

  • @pinoycoccoc4465
    @pinoycoccoc4465 Před 4 lety +1

    pwede pa send ng script? Salamat po. pinoy1coc@gmail.com