-
Notifications
You must be signed in to change notification settings - Fork 35
using ona with dnsmasq on a pfsense system
robfantini edited this page Aug 29, 2015
·
5 revisions
on pfsense we use dnsmasq for dns on our lan. this has been working for a few years . more detail and better formatting to follow.
on pfsense: click Services: DNS forwarder
Advanced: enter: addn-hosts=/etc/hosts.extra
you'll need to change the IP address on the scp and ssh lines.
we run from /etc/cron.d/ona-local every 2 minutes
#!/bin/bash # # if runnning from cli, this forces update to pfsense # also needed if we change subnet info as hosts will be same. # tty > /dev/null && > /root/hosts-ona # # 1- make a new hosts file. # # added set -e as had dcm fail - due to a msql backup in prpgress. , then script created a bad hosts at dns servers 2015-08-27 . # so make sure we exit if this line fails! # set -e /opt/ona/bin/dcm.pl -r ona_sql sql=simplehosts.sql|sed -e "s/\:/ /" -e "s/://g" > /root/hosts-ona.new # # 2- if new hosts file is different then the old one then update dns # if ! cmp -s /root/hosts-ona.new /root/hosts-ona ; then # save file for next compare /bin/cp -f /root/hosts-ona.new /root/hosts-ona # # make host file to be used by dnsmasq # # use sed eliminate header line # cat /root/hosts-ona | sed /"ip fqdn"/d > /root/hosts.extra tty > /dev/null && echo " pfsense " ## ** change the scp/ssh target to your pfsense address scp /root/hosts.extra 10.1.0.2:/etc/ ssh 10.1.0.2 /usr/local/sbin/pfSsh.php playback svc restart dnsmasq fi