Import DHCP reservations from Synology DHCP Server to OpenBSD dhcpd(8)

I am migrating a bunch of services from my Synology to OpenBSD ; DHCP Server being one of them. I have configured quite a few DHCP reservations over time. And I would like a better way to migrate them to dhcpd(8) than copy & paste ; or rewrite from scratch.

Synology DSM seem to use dnsmasq as a DHCP Server. The configuration file containing static leases is located in /etc/dhcpd/dhcpd.conf.

On OpenBSD, transfer the Synology dnsmasq configuration file and create an /etc/dhcpd.conf(5)  file configured for your subnet. If vi(1) is used for the edition, place the cursor where the static leases should be inserted and issue :

:r!awk -F '[=,]' '/^dhcp-host=/ { print "\thost " $3 " {\n\t\thardware ethernet " $2 ";\n\t\tfixed-address " $4 ";\n\t}\n" }' /tmp/syno-dhcpd.conf

Et voilà. Tens of reservations imported in milliseconds.

Author: Joel Carnat

@work Technical Architect and SysAdmin ; @home OpenBSD and FOSS, Karate, Kobudō, Jōdō, Bodyweight workout, Photography & Music

One thought on “Import DHCP reservations from Synology DHCP Server to OpenBSD dhcpd(8)”

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.