Page 1 of 1

How to Configure DHCP Server for Static Leases Only

Posted: Sat Jul 13, 2024 8:01 pm
by dromon
Hello,

What is the best way to configure a DHCP server (CCR2004, ROS 7.14.1) that has no dynamic addresses? Specifically, I have a subnet that has a well-known list of clients; I want to ensure that no addresses are handed out beyond these approved MACs.

I tried the naive solution but it appears that ROS wants a configured pool:
[admin@MikroTik] > /ip/dhcp-server/add interface=sfp-sfpplus1 lease-time=30m name=dhcp1
[admin@MikroTik] > /ip/dhcp-server/network/add address=192.168.1.0/24 dns-server=192.168.1.2,192.168.1.3 gateway=192.168.1.1
[admin@MikroTik] > /ip/dhcp-server/lease/add mac-address=FE:ED:DE:AD:BE:EF address=192.168.1.10 server=dhcp1
invalid value for argument address:
    invalid value for argument ip-address
    input does not match any value of pool
I could create a pool with only the addresses which match the static addresses for my approved devices but then I would have to edit the pool every time a new device is installed; this seems sub-optimal. Is there a better way?

Thanks!

Re: How to Configure DHCP Server for Static Leases Only

Posted: Sat Jul 13, 2024 10:36 pm
by TheCat12
Use address-pool=static-only on the DHCP server and that should do the trick

Re: How to Configure DHCP Server for Static Leases Only

Posted: Sun Jul 14, 2024 1:03 am
by dromon
D'oh, a better way indeed...

Not sure how I missed that in the options but it does exactly what I need.

Thanks!