Skip to content
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

Synology DCHP / DNS update script broken in DSM 6.0-7321 #7

Closed
chriscjcj opened this issue Apr 15, 2016 · 11 comments
Closed

Synology DCHP / DNS update script broken in DSM 6.0-7321 #7

chriscjcj opened this issue Apr 15, 2016 · 11 comments

Comments

@chriscjcj
Copy link

chriscjcj commented Apr 15, 2016

The script that takes the Synology DHCP database and creates DNS A records from them is unfortunately broken in DSM 6. The script runs and deletes all A records from the DNS zone file, but it no longer repopulates it. So, if you update to DSM 6, beware... you'll have an empty zone file. I attempted to reach out to Tim Smith through the Synology forums, but his last post was in 2014 and he hasn't responded yet. I have been trying to figure this one out myself, but I'm in over my head. Any chance you could take a look at it and see if you can figure out why it's not working?

The original thread where this script was discussed can be found here:
https://forum.synology.com/enu/viewtopic.php?f=233&t=88517&p=429340

Many thanks,
-Chris Johnson

@zimmerlis
Copy link

Hi Chris, I have had the same issue, and I have found a solution.
If you run the script in DSM v6 on the console then the following erorr is shown:

awk: cmd. line:5: fatal: cannot open file `/etc/dhcpd/dhcpd-static-static.conf' for reading (No such file or directory)

The name of the DHCPStatic file containing the reservations has changed:
/etc/dhcpd/dhcpd-eth0-static.conf

So change the line contains the "DHCPStatic" in your script:
from: DHCPStatic=/etc/dhcpd/dhcpd-static-static.conf
to: DHCPStatic=/etc/dhcpd/dhcpd-eth0-static.conf

On my DSM v6 this script workes again as before! :-)

Regards, Rene

@gclayburg
Copy link
Owner

Good catch, guys. I haven't yet tried this on DSM 6, but I plan to shortly. I'll update these scripts so that they work on both DSM 5 and 6. Testing might be a bit tricky though, since I only have one synology server to work with.

@chriscjcj
Copy link
Author

Rene, Thank you so very much for posting this! It works for me as well. I shall post this fix in the Synology forum where this script was originally discussed.

@gclayburg
Copy link
Owner

Or better yet, @zimmerlis , could you create a pull request from with your script update?

@chriscjcj
Copy link
Author

I'll update these scripts so that they work on both DSM 5 and 6. Testing might be a bit tricky though, since I only have one synology server to work with.

I will be happy to test it on DSM 6. Just let me know. 👍

@gclayburg
Copy link
Owner

@chriscjcj @zimmerlis I wonder if you guys are using an older version of this script. I added error checking quite some time ago to first check for the existence of the DHCP static leases file.

BTW, I just also updated the script to also check for leases that may exist in the /etc/dhcpd/dhcpd-eth0-static.conf file. @chriscjcj can you verify that this script now works under DSM 6?

@chriscjcj
Copy link
Author

chriscjcj commented Apr 19, 2016

I was indeed using a rather old version of this script. I have updated with the most current revision. (3317c4e) I deleted several A records from the zone file which were based on DHCP lease reservations. I then ran the script. The script successfully repopulated the zone file with all of the host names from the DHCP server. So near as I can tell, it works beautifully.

THANK YOU for your assistance on this. I'm truly grateful. If you ever find yourself in San Francisco, please let me know. I'll buy you a beer. :-)

P.S. Just installed DSM 6.0-7321 Update 2. Script works fine under both the initial DSM6 release as well as this "update 2."

@tonysurma
Copy link

tonysurma commented Sep 8, 2016

First off thanks for this! It is working great for me. One note on above in DSM 6.0 it appears that it went from a single static file to one per interface that DHCP is configured on. For example: I have DHCP only on the 4th Ethernet adapter (eth3) and so I don't have a -static-static or a -eth0-static and instead only have a -eth3-static. So it looks like the fix for 6.0 would be to add in static entries from any file -ethX-static.

I have a potential pull request for this but I think there would have to be a decision of do we have this concatenate together all ethX or make it a setting to pick which one (defaulting to eth0)?

I could imagine a world where someone wants different reverse zones updated from different ethX files if there are different IP ranges on multiple NICs... but maybe that isn't an issue...

@gclayburg
Copy link
Owner

On my system, I notice static dhcp-host addresses appear in both /etc/dhcpd/dhcpd-static-static.conf and /etc/dhcpd/dhcpd.conf. Both of these files are scanned by the script as it is now. @tonysurma does your system have duplicate dhcp-host entries?

My system uses the name "bond0" as the interface name. Maybe the simplest thing to do here is just look for dhcp-host entries in any /etc/dhcpd/dhcpd*static.conf file.

@tonysurma
Copy link

tonysurma commented Oct 12, 2016

on mine DS1515 on 6.1 I have nothing in dhcpd.conf and just in the static.conf file(s) (in my case only eth3 as I only have it live on my 4th NIC.

That all being said I just ran the current versions from your repo and all works properly so looks like it is fixed (for me at least)

Apologies for delay in testing but I think this can be closed - thanks again @gclayburg

@gclayburg
Copy link
Owner

For you folks running DSM 6, you might check the latest version just committed. @WolfspiritM created a PR that does a better job of determining network interfaces on your system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants