OPNsense Forum

English Forums => 25.1, 25.4 Production Series => Topic started by: davidfi01 on May 09, 2025, 07:06:09 PM

Title: 25.1.6_2 Import CSV with static dns mappings into DnsMasq
Post by: davidfi01 on May 09, 2025, 07:06:09 PM
What is the format needed for the csv file used to import static dns mappings into dnsmasq?

Thanks in advance.

D
Title: Re: 25.1.6_2 Import CSV with static dns mappings into DnsMasq
Post by: julsssark on May 09, 2025, 09:04:30 PM
I figured it out by creating a test entry and then doing an export. The headers in the export/import file are:

host,domain,ip,client_id,hwaddr,lease_time,ignore,set_tag,descr,aliases

I plan to migrate from KEA v4 over the weekend.
Title: Re: 25.1.6_2 Import CSV with static dns mappings into DnsMasq
Post by: davidfi01 on May 11, 2025, 06:48:41 PM
Hi -

1) How did you create the export?

2) can you supply a sample csv?  I tried creating several (including one with your headers) and fail on import everytime.

I receive this error for every entry in the csv:

!! A value is required.
!! Option not in list.

best,
D
Title: Re: 25.1.6_2 Import CSV with static dns mappings into DnsMasq
Post by: wrobelda on May 16, 2025, 03:34:49 PM
I wrote a script to convert the ISC mappings to DnsMasq CSV file, hopefully someone finds that useful:

https://gist.github.com/wrobelda/403fe4e7ff542ce14a4bba9a06e40777
Title: Re: 25.1.6_2 Import CSV with static dns mappings into DnsMasq
Post by: meyergru on May 16, 2025, 03:47:05 PM
There is also this Github repo (https://github.com/meyergru/iscdhcp_to_dnsmasq), which can be used for much the same purpose.
Title: Re: 25.1.6_2 Import CSV with static dns mappings into DnsMasq
Post by: julsssark on May 16, 2025, 03:51:12 PM
1) I exported the Kea reservations and opened them in Excel. I used all of the column headers as posted earlier (i.e., I left unused entries blank) and left the headers in the same order as posted (the Kea columns are named slightly different and are in a different order). I then copied/pasted the data into the correct columns. Lastly, I saved as CSV format and imported into DNSmasq.

2) Sorry, I did not save the import file. I deleted it after importing.