DHCP Design

Hi all, could someone help me with a DHCP design issue?
In my environment, I have 4 routers providing a Guest network for 15k users. To balance the load, all routers are in the same VLAN with DHCP enabled and the default gateway set to itself. In practice, the client will send a DHCP request and the server that responds first will be the gateway for the client.

However, this way, the clients are not balanced equally between the servers. Could someone give me an sugestion of ​​how to create a more robust DHCP structure that can better balance the clients?

Thanks

When we build designs of this scale we group APs into different VLANS then have a VRRP router pair in each VLAN.

I had a few ideas how you might approach this problem with your requirement to keep a single VLAN but I think the best one is to use the script function of the DHCP lease.

The script option runs each time a lease is issued. You could use this to change the gateway value for the DHCP server config each time a lease is issued.
Something like: If current gateway is router 2, set gateway address as router 3.
The next time a lease is issued the next client gets router 3 as its gateway. Then router 4 and back around to router 1 etc.

Apply this same config on each of your routers and you should end up with the same redundancy you want but also a well balanced number of clients routing through each one. And it doesn’t matter which router issued the address.

i didn’t know that i could do that using scripts… I will try that, thanks for the suggestion!

Relevant docs on the dhcp-server script function are here: https://help.mikrotik.com/docs/spaces/ROS/pages/24805500/DHCP#DHCP-DHCPServer

There are also a few global vars you can use to get information about the current lease, you might for instance only want to action a gateway update if $leaseBound = 1. It might take a little bit of experimentation to get the optimal set of conditions.

Let us know how it works out :slight_smile:

A script that will be executed after a lease is assigned or de-assigned. Internal “global” variables that can be used in the script:
leaseBound - set to “1” if bound, otherwise set to “0”
leaseServerName - DHCP server name
leaseActMAC - active mac address
leaseActIP - active IP address
lease-hostname - client hostname
lease-options - an array of received options

Never though having 15k users :open_mouth:
Almost swept 192.168.0.0/18 subnet