DHCP Service: mknod Error

vyos-1-2
dhcp-server

#1

when attempting to save my DHCP configuration, the system seems to not recognize the path for the dhcpd.leases file ‘/config/’

vyos@vyos# commit
[ service dhcp-server ]
Traceback (most recent call last):
File “/usr/libexec/vyos/conf_mode/dhcp_server.py”, line 813, in
apply©
File “/usr/libexec/vyos/conf_mode/dhcp_server.py”, line 802, in apply
os.mknod(lease_file)
FileNotFoundError: [Errno 2] No such file or directory

[[service dhcp-server]] failed
Commit failed
[edit]

If I go in and edit the file /usr/libexec/vyos/conf_mode/dhcp_server.py and set the path to /opt/vyatta/config/dhcpd.leases and then run the same commands in config mode and commit it all works fine.

This is based on the rolling release vyos-1.2.0-rolling+201902201040-amd64

Is this an issue with the rolling release, or have I done something wrong?


#2

Can you provide the configuration commands for DHCP that you are using?


#3

Well, it looks like its a case with the Live CD. Once I install the image to the HD I no longer have the issue. In Live mode, the commands issued that result in the error mentioned are:

set interfaces ethernet eth0 address '192.168.0.1/24'
set service dhcp-server shared-network-name LOCAL subnet 192.168.0.0/24 default-router '192.168.0.1'
set service dhcp-server shared-network-name LOCAL subnet 192.168.0.0/24 dns-server '8.8.8.8'
set service dhcp-server shared-network-name LOCAL subnet 192.168.0.0/24 range LOCAL start 192.168.0.10
set service dhcp-server shared-network-name LOCAL subnet 192.168.0.0/24 range LOCAL stop 192.168.0.50
commit

#4

Yeah, when you run from the iso /config and a few other directories you usually have for persistent stroage, won’t exist. I had a similar issue reported with wireguard (https://github.com/vyos/vyos-1x/commit/af63311f7a0dccd4abdae1bdc139c3fe4613249c), might be worth to open a task in phabricator.


#5

And hence my hack for the iso to change the location of the lease file in the dhcp_server.py to a persistent storage location worked … but obviously not a solution :slight_smile:


#6

The script could test if the location exists and if not creates it. That way it would work from the iso too.