Feature #13806
closed
Implement dnsmasq DHCP/DNS provider
Added by Lukas Zapletal almost 9 years ago.
Updated over 6 years ago.
Description
It looks like Dnsmasq in Fedora 23+ is capable enough so it can be used directly to manipulate both DHCP and DNS authoritative records, therefore brand new provider can be built which will replace virsh provider. All integration can be done via reading and writing own files and sending SIGHUP signal.
Particular options which allows clean integration: --dhcp-hostsdir, --dhcp-optsdir, --hostsdir
and SIGHUP for deletion of records. Also DHCP leases can be easily parsed from a file.
Virsh provider will be still relevant, because dnsmasq instances managed by libvirt are not allowed for own configuration, therefore this provider will only work with own (non-libvirt) instances which are used to manage bare-metal networks.
The relevant dnsmasq configuration is:
dnsmasq --addn-hosts=/path/to/dir/with/dns_records/ --dhcp-hostsfile=/path/to/dir/with/dhcp_records/
After each change (file added or removed), SIGHUP must be sent in order to reload the change. Although dnsmasq supports file monitoring (perhaps via inotify), it only provides this for dhcp entries and not dns records which is an inconsistency. And it will unlikely work on BSD or MacOS, so sending the signal is safe and better option for the initial implementation.
- Status changed from New to Assigned
- Priority changed from Normal to Low
Dnsmasq supports multiple DHCP ranges, all host entries can be put into the single directory. For this reason, network option from the foreman-proxy API will be completely ignored.
For DNS, dnsmasq only supports adding A/AAAA records which creates PTR record automatically. Therefore the PTR CRUD API calls will only check if the associated record is present or not and throw an error, but it will always perform no action.
Implementation detail - both DHCP and DNS files are just one line, the payload can be also stored in the filename itself which will allow reading all required information just by listing them For DHCP, subnet will be the prefix so they can be easily filtered without opening them or listing them all.
- Status changed from Assigned to New
- Assignee deleted (
Lukas Zapletal)
- Status changed from New to Resolved
setting to resolved, as there are dnsmasq plugins from the community now.
Also available in: Atom
PDF