Skip to content

using ona with dnsmasq running on a debian system

robfantini edited this page Oct 22, 2016 · 13 revisions

part 1 on dnsmasq server

mkdir -p  /fbc/dns
mkdir -p /fbc/bin
  • add to dnsmasq.conf
addn-hosts=hosts.extra  #  use full pathname

fbc = federation business computing

part 2 at the system running ona

  • create /opt/ona/sql/simplehosts.sql
select INET_NTOA(i.ip_addr) ip,
       concat(dns.name,".",z.name) fqdn," # ",i.mac_addr mac,
       concat(" ",m.name," ",models.name," (",roles.name,")") device_type 
from   interfaces i,
       dns,
       domains z,
       subnets s,
       manufacturers m,
       models,
       roles,
       device_types,
       hosts,
       devices
where  i.host_id = hosts.id
and    dns.domain_id = z.id
and    dns.interface_id = i.id
and    dns.type like 'A'
and    s.id = i.subnet_id
and    devices.id = hosts.device_id
and    models.manufacturer_id = m.id
and    device_types.model_id = models.id
and    device_types.role_id = roles.id
and    devices.device_type_id = device_types.id
order by i.ip_addr
  • make a new hosts file.
/opt/ona/bin/dcm.pl -r ona_sql sql=simplehosts.sql |  \ 
sed -e "s/\:/      /" -e "s/://g" > /root/hosts-ona.new

Then i use a script to see if the file changed, if so scp to dnsmasq server, and restart/reload service.