Closed linuxfrag closed 2 years ago
This is similar to #4. Evidently, there are a lot of scenarios where the udm removes entries. I've been running a separate DNS server and so I haven't yet tried to chase down (a) what events trigger the removals (b) a great way to ensure they persist. I've also had others report the same problem on social media.
Sooo.... I'm sensing I'll take another look this week at trying a new iteration.
@linuxfrag FYI, after some experimentation, it seems that a bunch of actions unrelated to DNS result in the dnsForwarder
hostRecords
being rebuilt to only include setup.ui.com
, unifi.<domainname>
for each network domain name and
The only think I can see doing is to build a local db/file containing custom entries, monitor for changes to /var/run/dnsmasq.conf.d/dns.conf
or /config/ubios-udapi-server/ubios-udapi-server.state
and reregister the custom entries when they disappear. I'm looking into how to do this now.
Hello there,
2 feedbacks :
I wanted to check if there is any update on this. The script works great, I just have to apply it every time there is a change, upgrade, reboot etc.. I submitted a feature request with them, but dont expect them to act on that. Any idea how to automate the process?
While I don't like my solution I fixed this problem using boot scripts. First I created a script that adds all DNS entries at boot time. which is quite easy to do using https://github.com/boostchicken-dev/udm-utilities/tree/master/on-boot-script. Additionally I added another script that adds a cron job at boot time that checks every minute if my DNS entries are still available, and if not, adds them again.
The solutions works during configuration changes, and should also work for updates. Did not have the chance to test that yet, but should work.
While I don't like my solution I fixed this problem using boot scripts. First I created a script that adds all DNS entries at boot time. which is quite easy to do using https://github.com/boostchicken-dev/udm-utilities/tree/master/on-boot-script. Additionally I added another script that adds a cron job at boot time that checks every minute if my DNS entries are still available, and if not, adds them again.
The solutions works during configuration changes, and should also work for updates. Did not have the chance to test that yet, but should work.
Can you be so kind to share those scripts? it would be a great workaround
Since it's just a quick hack yet no full scripts here.
The "workaround":
A. Add all hosts at startup using on-boot-script ( https://github.com/boostchicken-dev/udm-utilities/tree/master/on-boot-script) B. Create a cron entry that checks if all hosts / one host are still there, and if not, add them again. The cron entry has to be recreated during every startup to make it 'static'. We simply add our hosts once they get lost during config change.
What I did (all files/scriptes are owned by root):
#!/bin/sh
/mnt/data/udm-host-records/add-host-record.sh host-a ip-address-a
/mnt/data/udm-host-records/add-host-record.sh host-b ip-address-b
...
#!/bin/sh
/mnt/data/udm-host-records-/add-static-hosts.sh
#!/bin/sh
if [ `/mnt/data/udm-host-records/list-host-records.sh | grep YOURHOSTNAME | wc -l` -eq 0 ]
then
/mnt/data/udm-host-records/add-static-hosts.sh > /dev/null
fi
* * * * * /mnt/data/udm-host-records/add-static-hosts-if-needed.sh
#!/bin/sh
cp -f /mnt/data/udm-host-records/host_check /etc/cron.d/host_check
# optionally chmod 0644 /etc/cron.d/host_check
/etc/init.d/crond restart
@frenchc solution also works fine if you just run '/mnt/data/udm-host-records-/add-static-hosts.sh' in your cron job and skip the check if hosts are still listed step. Feels about the same level of brute force.
That works, too;). Unifi internals are still a black box to me, so my workaround is as less invasive as possible (based on my limited knowledge).
I don't have an answer, but because the criteria for updating hostRecords isn't clear, this repo can't offer to solve the DNS via UDM problem. I'm deprecating the repo.
These scripts work great but changes do not stick. Even without a reboot sometime( maybe an hour or hours later) the UDM Pro revmoes all these entries back to default. I can verify the changes work before this happens since I'm using NextDNS and seeing these new host entries take effect.
Anyway to make these settings stick?