Today's blog post explains how to get this very useful component of the TinyDNS project to work with Ubuntu Server. You may fetch down the Michael Stella's original version of his code, and then note my adjustments to get it to work on the Ubuntu Server (9.04 through 10.04).
http://www.thismetalsky.org/projects/dhcp_dns
Unpack the file, then make the following adjustments:
Patching up djb_update.pl
# Domain name
-my $domain_name = "MYDOMAIN";
+my $domain_name = "lds-demo.lueckdatasystems.com";
# DHCPD lease file
-my $lease_file = "LEASEFILEPATH";
+my $lease_file = "/var/lib/dhcp3/dhcpd.leases";
## where does tinydns stuff live?
-my $tinydnspath = "TINYDNSPATH";
+my $tinydnspath = "/etc/tinydns";
# tinydns text database files
-my $dhcp_dnsfile = "dhcp.$domain_name";
-my $static_dnsfile = "static.$domain_name";
+my $dhcp_dnsfile = "/etc/tinydns/root/dhcp.$domain_name";
+my $static_dnsfile = "/etc/tinydns/root/static.$domain_name";
# number of seconds to check the lease file for updates
my $update_freq = 30;
Fix the master Makefile as follows:
-PREFIX = /tmp
-DOMAIN = myseasons.com
-TINYDNSPATH = /tmp
-DNSCACHEPATH = /tmp
-LEASEFILE = /var/db/dhcpd.leases
+PREFIX =
+DOMAIN = lds-demo.lueckdatasystems.com
+TINYDNSPATH = /etc/tinydns
+DNSCACHEPATH = /etc/dnscache
+LEASEFILE = /var/lib/dhcp3/dhcpd.leases
# END CONFIGURE
Fixing up Makefile which running the installer Makefile creates - I have simply put my entire Makefile here as lots of adjustments were made. It will be found in your /etc/tinydns/root directory.
db.lds-demo.lueckdatasystems.com: static.test-smb.lueckdatasystems.com dhcp.test-smb.lueckdatasystems.com
@echo "# DO NOT EDIT THIS FILE DIRECTLY" > db.lds-demo.lueckdatasystems.com
cat static.lds-demo.lueckdatasystems.com dhcp.lds-demo.lueckdatasystems.com >> db.lds-demo.lueckdatasystems.com
data: db.lds-smb.lueckdatasystems.com
@echo "# DO NOT EDIT THIS FILE DIRECTLY" > data
cat db.lds-demo.lueckdatasystems.com >> data
In this file, the original developer attempted to support multiple static files. The current version of Make does not work correctly with the wildcard, so it was necessary to hard-code the filename and not make use of a wildcard.
To get the script started when the server boots up, I added an entry to my /etc/rc.local file as follows:
Make sure the files in your /etc/tinydns/root are all proper after the installation. You will probably need to do some file renames / moves in order to get things nice and tidy.
That should be it!