Error committing dhcp server configuration: NameError

Hey there, first time attempting to use VyOS!

I’m having trouble getting the dhcp server to work (or getting the configuration to commit). Here is what VyOS requested that I include in help request:

Report Time:      2021-01-03 06:58:29
Image Version:    VyOS 1.3-rolling-202101020217
Release Train:    equuleus

Built by:         autobuild@vyos.net
Built on:         Sat 02 Jan 2021 02:17 UTC
Build UUID:       48788df3-40c0-4ddc-90f5-97fa0ace7658
Build Commit ID:  ba6dab895279f6

Architecture:     x86_64
Boot via:         installed image
System type:      VMware guest

Hardware vendor:  VMware, Inc.
Hardware model:   VMware Virtual Platform
Hardware S/N:     VMware-56 4d 15 ea 1f 7d 77 40-47 a7 c6 94 1d 89 43 b8
Hardware UUID:    ea154d56-7d1f-4077-47a7-c6941d8943b8

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/dhcp_server.py", line 291, in <module>
    c = get_config()
  File "/usr/libexec/vyos/conf_mode/dhcp_server.py", line 125, in get_config
    for slice in dhcp_slice_range(subnet_config['exclude'], r_config):
  File "/usr/libexec/vyos/conf_mode/dhcp_server.py", line 95, in dhcp_slice_range
    if ra not in output:
NameError: name 'ra' is not defined

[[service dhcp-server]] failed
Commit failed

I can’t find anything that looks like ‘ra’ in my configuration, copied here:

vyos@vyos# show service dhcp
shared-network-name LAN {
authoritative
subnet 192.168.2.0/24 {
default-router 192.168.2.1
dns-server 192.168.2.1
domain-name liger-av.net
exclude 192.168.2.1
lease 86400
range 0 {
start 192.168.2.10
stop 192.168.2.200
}
}

Additionally, earlier I checked the dhcp server logs and saw another error, that the dhcp server had “no subnet declaration”. Googling this showed that that error in regular linux distros is solved by explicitly binding the dhcp server to an interface, but I couldn’t find any info on doing this in VyOS. I’m not sure the error is even related to the NameError that’s preventing me from committing, but any advice/info related to either will be very much appreciated!

Hi @jonah,

this is clearly a bug and is tracked via ⚓ T3180 DHCP server raises NameError.

In the meantime until the bug is fixed you can remove the exlucde address: delete service dhcp-server shared-network-name LAN subnet 192.168.2.0/24 exclude 192.168.2.1 as the exclude statement is only required if you wan’t to exclude addresses inside your range definition, and you range clearly is outside of your exclude address at all.