-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Same device appears twice in the dns list #27
Comments
By now I have changed the lease time of my DHCP server to 1 hour, which greatly reduces the # of double entries. But for some strange reason, still double entries appear in my DNS server which I cannot explain. Where my DHCP server looks quite normal like this: Here's whats in the scrips folder: |
ah sorry hit the wrong button :( hence reopened. |
I haven't looked at this in quite a while, but I would do 2 things first in troubleshooting this:
|
1 I downloaded the scrips from this repo about 3 days ago, so it is failrly up-to-date
After doing this, initially all looks well. AFter a day the extra entries appeared. Maybe the attachment (zip) I sent in the 2nd comment can shed some light on it for you. It contanis the dns_backups folder from my system. I'll do it once more now my dhcp client leases are more or less "clean". I'll let you know. Otherwise, I'll have to deep-dive into shell script debugging 😱 Regards Hans |
Ok, There could likely be an issue if you have the same hostname showing up as 2 different IP address leases. This isn't an issue I've run across before. Pull requests are certainly welcome! |
Being an experienced programmer (C#, Java, Delphi, C, c++) myself, I thought I'm gonna fix this. I have no clue where to start. At line 112 is comments that it sorts and removes duplicates, but I cant see where and how. IMO the entries having the same hostname should be ruled out based on how old the DHCP leases are, or if thats not possible the longest remaining lease time. This is not availble in the leases file unfortunately. Also I think it would be a lot better if the DNS TTL matches the remaining DHCP lease time. Now, my DNS TTL is 86400 where my DCP lease time is about 3600. How to accomplish this? - clueless :( Hints and explanations are welcome! |
You knoiw what... I' try to put it into a c# app , startable using mono or mono-service. That will be a nice excercise to do cross platform development, services and c#. I'll publish it on github if I am happy with the result and let you know. At least your scripts pointed me the doirection of a viable solution, thanks! |
That would be interesting, @HHasenack . The way I ended up working on this and troubleshooting was basically breaking the script down to individual awk scripts and running them separately on the synology to see what it does. Some troubleshooting can also be done on a normal linux install, but some things are just weird in synology world. They use a customized busybox and not all tools are available. BTW - the sorting and removing duplicates is implemented on line 139: try running that awk script by itself and see what it does |
interesting ebough the double source lines appear originate from reading dhcp-leases.log as well as dhcpd.conf.leases which contain the same data on ly system (DSM6). I would expect to sort / uniq to drop these duplicates. I'll studdy the man pages for these. As said before, I am a noob at shell script programming, and the "nested" awk command is a bit above my level 📦 I'll try executing the steps one by one to take a look at the intermediate results, but am stil unsure how to do that ... I have started my C# app, and created some models for the DNS and DHCP entrries. Quite a challenge, but a good exercise. |
T think I have managed to work around the problem. Problem was actually caused by de script merghing in the static dhcp leases with the dhcp log file, in which the leases were duplicated (DSM 6.0) I have attached the modified script in here as I dont want to break code for older releases. No clue how to check for DSM versiuon. Changes are marked using HH20180918 |
@HHasenack just a huge THANK YOU for posting your fix to this problem. I'd been getting duplicate entries for a while, very frustrating. I installed your patched version a few weeks ago and NO MORE DUPES! |
Which is caused eg by my phone sometimes using my 5G wifi and other times my 2G4 network. The Synology DNS has problems coping with this, causing other devices to not resolved. (the devices appearing after the double entry)
Solution would be to ensure entries are uniwue, and in case of double dhcp entries, use the entry with the longest remaining lease time ( thus the youngest, or the bottommost?)
I am quite a noob at shell programming, otherwise I would try fixing this myself 🈂️
the galaxy-a5-hans device also appears on my dns server twice (no screenshot since I dropped one to get it working again)
The text was updated successfully, but these errors were encountered: