I have such DHCP server configuration:
dhcp-server { shared-network-name DMZ { authoritative subnet 10.0.20.0/24 { default-router 10.0.20.1 dns-server 10.0.20.1 lease 28800 range 0 { start 10.0.20.11 stop 10.0.20.254 } static-mapping PC { ip-address 10.0.20.101 mac-address mac1 } static-mapping PC2 { ip-address 10.0.20.102 mac-address mac2 } <...> static-mapping PC15 { ip-address 10.0.20.115 mac-address mac15 } } } }
With this configuration, the server can issue addresses, that is in static-mapping, to random dhcp-client.
(When the static-mapped pc tries to get the address, it will receive it correctly if the address is not issued).
In log i see error (error occurs every time, when dhcp-server try to issue static-mapped ip):
Oct 1 16:51:44 NR dhcpd: Dynamic and static leases present for 10.0.20.102 Oct 1 16:51:44 NR dhcpd: Remove host declaration DMZ_PC2 or remove 10.0.20.102 Oct 1 16:51:44 NR dhcpd: from the dynamic address pool for DMZ
The simple solution is to use exclude in configuration, but it is imposible with consecutive addresses.
When i try to commit:
exclude 10.0.20.101 exclude 10.0.20.102
i receive error:
vyos@NR# commit [ service dhcp-server ] DHCP range stop address 10.0.20.101 must be greater or equal to the range start address 10.0.20.102! [[service dhcp-server]] failed Commit failed