Feature #13806
closedImplement dnsmasq DHCP/DNS provider
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.
Updated by Lukas Zapletal over 8 years ago
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.
Updated by Lukas Zapletal about 8 years ago
- 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.
Updated by Lukas Zapletal about 8 years ago
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.
Updated by Anonymous almost 8 years ago
lzap, want to try these? :)
https://rubygems.org/gems/smart_proxy_dhcp_dnsmasq
https://rubygems.org/gems/smart_proxy_dns_dnsmasq
Updated by Lukas Zapletal almost 8 years ago
Yeah nice indeed, https://github.com/ace13/smart_proxy_dhcp_dnsmasq/issues/1
Updated by Lukas Zapletal over 7 years ago
- Status changed from Assigned to New
- Assignee deleted (
Lukas Zapletal)
No time for this now.
Updated by Anonymous over 6 years ago
- Status changed from New to Resolved
setting to resolved, as there are dnsmasq plugins from the community now.