load balance dhcp wans

I have done load balancing with pfSense but just got my first RouterBoard today.

I can not find a single guide that does not use static IPs.

All my WANs are DHCP and the IP/Gateway can be in very different pools and change frequently.

Is it possible to load balance with DHCP WANs?

Edit:

I found a script that apparently will help me setup load balance on DHCP WANs.

:local clientcounter
:local routecounter
:local duplicatecounter
:local routeupdated "no"
:foreach clientcounter in=[/ip dhcp-client find] do={
:local routingmarkname ([/ip dhcp-client get $clientcounter interface] . "-mark")
:local newroutinggateway [ip dhcp-client get $clientcounter gateway]
:foreach routecounter in=[/ip route find where routing-mark=$routingmarkname] do={
  :local routinggateway [/ip route get [find routing-mark=$routingmarkname] gateway]
	:if ([:len $newroutinggateway] > 0) do={
	  :if ($"routinggateway" != $"newroutinggateway") do={ 
	    /ip route set $routecounter gateway=$newroutinggateway 
		:set routeupdated "yes"
	  }
	}
  } 
  :if ([:len $newroutinggateway] > 0) do={
    :if ($routeupdated = "no") do={
      /ip route add routing-mark=$routingmarkname gateway=$newroutinggateway dst-address=0.0.0.0/0
    }
  }
}

Can someone confirm it will work for my setup?

  MikroTik RouterOS 5.14 (c) 1999-2012       http://www.mikrotik.com/

jan/02/1970 01:00:13 dhcp,critical,error dhcp-client on ether2 lost IP address 154.20.241.99 - received NAK from dhcp server 192.168.1.254
[admin@MikroTik] > /export compact
# jan/02/1970 01:13:11 by RouterOS 5.14
# software id = ULUJ-IPE8
#
/interface bridge
add admin-mac=00:0C:42:F3:6F:FB auto-mac=no l2mtu=1598 name=bridge-local protocol-mode=rstp
/interface ethernet
set 0 name=ether1-gateway
set 5 name=ether6-master-local
set 6 master-port=ether6-master-local name=ether7-slave-local
set 7 master-port=ether6-master-local name=ether8-slave-local
set 8 master-port=ether6-master-local name=ether9-slave-local
set 9 master-port=ether6-master-local name=ether10-slave-local
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=default-dhcp disabled=no interface=bridge-local name=default
/interface bridge port
add bridge=bridge-local interface=ether3
add bridge=bridge-local interface=ether4
add bridge=bridge-local interface=ether5
add bridge=bridge-local interface=ether6-master-local
/ip address
add address=192.168.88.1/24 comment="default configuration" interface=bridge-local
/ip dhcp-client
add comment="default configuration" disabled=no interface=ether1-gateway
add disabled=no interface=ether2
/ip dhcp-server network
add address=192.168.88.0/24 comment="default configuration" dns-server=192.168.88.1 gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 name=router
/ip firewall filter
add chain=input comment="default configuration" protocol=icmp
add chain=input comment="default configuration" connection-state=established
add chain=input comment="default configuration" connection-state=related
add action=drop chain=input comment="default configuration" in-interface=ether1-gateway
/ip firewall mangle
add chain=prerouting dst-address=192.168.1.0/24 in-interface=bridge-local
add chain=prerouting dst-address=154.20.240.0/24 in-interface=bridge-local
add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=ether1-gateway new-connection-mark=wan1
add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=ether2 new-connection-mark=wan2
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local in-interface=bridge-local new-connection-mark=wan1 \
    per-connection-classifier=dst-address:2/0
add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-type=!local in-interface=bridge-local new-connection-mark=wan2 \
    per-connection-classifier=dst-address:2/1
add action=mark-routing chain=prerouting connection-mark=wan1 in-interface=bridge-local new-routing-mark=towan1
add action=mark-routing chain=prerouting connection-mark=wan2 in-interface=bridge-local new-routing-mark=towan2
add action=mark-routing chain=output connection-mark=wan1 new-routing-mark=towan1
add action=mark-routing chain=output connection-mark=wan2 new-routing-mark=towan2
/ip firewall nat
add action=masquerade chain=srcnat comment="default configuration" out-interface=ether1-gateway
add action=masquerade chain=srcnat out-interface=ether2
/ip route
add distance=1 gateway=192.168.1.1 routing-mark=towan1
add distance=1 gateway=154.20.240.254 routing-mark=towan2
add distance=1 gateway=192.168.1.1
add distance=2 gateway=154.20.240.254
/tool mac-server
add disabled=no interface=ether2
add disabled=no interface=ether3
add disabled=no interface=ether4
add disabled=no interface=ether5
add disabled=no interface=ether6-master-local
add disabled=no interface=ether7-slave-local
add disabled=no interface=ether8-slave-local
add disabled=no interface=ether9-slave-local
add disabled=no interface=bridge-local
/tool mac-server mac-winbox
set [ find default=yes ] disabled=yes
add interface=ether2
add interface=ether3
add interface=ether4
add interface=ether5
add interface=ether6-master-local
add interface=ether7-slave-local
add interface=ether8-slave-local
add interface=ether9-slave-local
add interface=bridge-local
[admin@MikroTik] >

A quick glance at your first script looks like it is designed to set routing-marks on dynamically learned gateways. If that is your desire, here is how I accomplish the same, without scripting, using native ROS features available with recent versions.

If your dynamic assignments are via DHCP, set the default-route-distance to a unique value for each WAN provider. If PPPoE, you cannot set it, so it will default to a value of 1. The following will not work if you have more than one PPPoE provider because of this limitation.

Use “/routing filter” on the “chain=dynamic-in” with a distance matching that which you statically set in the dhcp-client (or 1 if PPPoE). The action should be accept with a set-routing-mark and optionally a set-distance (if the uniquely set dhcp-client distance value is not appropriate in your routing situation).

Using this method to mark default routes will not require a script to run regularly and will instantly apply the mark, the moment a new gateway is learned.

I combine the above with /ip firewall mangle rules and PCC matchers to split traffic across multiple providers and even force certain traffic types over preferred providers.

Best regards to all!
Well, i am newby on mikrotik.
First i use it as ordinary router on x86 platform, i set it with help of youtube :smiley: and it worked like charm for over a year.
Butt now i have a problems, x86 router is no more, RB750 take it place.
My working settings are:
ether1: DHCP client connected to ISP Cable modem 15/1.5Mbps
ether2: DHCP client connected to ISP ADSL router 5/1Mbps
ether3: unused
ether4: HomeLAN with DHCP server 192.168.1.1
ether5: ServerLAN with DHCP server 10.10.10.1

Everything working fine, i set simple queue to limit download to ServerLAN and upload to HomeLAN, i make multiple ports forwarded etc.
But only one interface to internet is working, and i can not make load balancing betwen to WANs ether1 and ether2.
Last two days i trying different techniques and read about balancing on mikrotik manual, but all that i find is considered to have static adresses on wan ports.
Ok, i do not to be laisy so i try to make corrections to firewall mangles and ip routes that i found and studied on internet, but best that i achieve is to not have Rx/Tx equal to 0 on one wan port, mostly it is few bytes.
Please, can someone make example for this situation.
Thanks.