Page MenuHomeVyOS Platform

DHCP static mapping and exclude address not working
Closed, ResolvedPublicBUG

Description

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:

[email protected]# 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

Details

Difficulty level
Normal (likely a few hours)
Version
1.2.x
Why the issue appeared?
Design mistake
Is it a breaking change?
Behavior change

Event Timeline

c-po triaged this task as Normal priority.
c-po changed Difficulty level from Unknown (require assessment) to Normal (likely a few hours).
c-po renamed this task from DHCP static mapping work wrong to DHCP static mapping and exclude address not working.Oct 3 2019, 11:23 AM

I can confirm the issue. Actually it boils down to two individual ones.

  • The error message on overlapping DHCP ranges
  • The behavior that multiple exclude addresses work without a problem as long as they are not consecutive

This suxx ... working on a fix already

c-po changed Why the issue appeared? from Will be filled on close to Design mistake.
c-po moved this task from Needs Triage to Finished on the VyOS 1.2 Crux (VyOS 1.2.4) board.
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.