this tool allows to have delegated dns domain to opennebula with dns names for every vm.
vm dns names with vmid look like 3456.vms.my.domain.int. additionaly, there are dns names based on vm name with truncated suffix with vmid. this has sideefect for vms with the same base name - it allow having round robin ballancing.
currently we use /etc/hosts.dnsmasq to not interferre with system /etc/hosts. using hosts file has some drawbacks, like nonexistent wildcards.
# ssh 75.vms.mydomain.int
Last login: Fri Jan 10 02:33:42 2014 from 192.168.1.80
...
*/10 * * * * /usr/local/sbin/one-gen-hosts-dnsmasq-cron.sh "192.168" ".vms.onedev1.etn"
*/10 * * * * /usr/local/sbin/one-gen-hosts-dnsmasq-synctons.sh "some-dnsmasq-host"
in addition to this cron task, its better to have opennebula hook to have dns records available in the moment vm is created.
on both (intermediate dnsmasq and final mgmt host):
no-hosts
addn-hosts=/etc/hosts.dnsmasq
on intermediate dnsmasq
server=/vms.mydomain.int/10.20.30.40
server=/localdomain/192.168.1.1
local=/vms.mydomain.int/
local=/localnet/
required ssh login to oneadmin user with sudo privilege:
oneadmin ALL=(root) NOPASSWD: /etc/init.d/dnsmasq
- /etc/hosts.dnsmasq should be writable by oneadmin
- requires ssh access to oneadmin user with ssh key
script is intended to be run as oneadmin to have access
Cmnd_Alias ONE_DNS = /usr/local/sbin/one-gen-hosts-dnsmasq-cron.sh
Cmnd_Alias ONE_DNS_PUSH = /usr/local/sbin/one-gen-hosts-dnsmasq-synctons.sh
#oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN
oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_DNS, ONE_DNS_PUSH
VM_HOOK = [
name = "regen-dns",
on = "CREATE",
command = "/usr/bin/sudo /usr/local/sbin/one-gen-hosts-dnsmasq-cron.sh",
arguments = "192.168 .vms.mydomain.int" ]