Debian and Ubuntu DDNS with Bind9 and DHCP
This tutorial is a continuation of my previous post How to setup a LAN DNS server using Bind9 under Debian and Ubuntu Linux which covers the installation of bind9 on a Debian/Ubuntu system. This new tutorial will cover the Dynamic DNS features of bind9.
I assume that you have a running DNS server and configured based on this tutorial.
First we will change the owner of /var/cache/bind to user:bind and group:bind.
We will update the file /etc/bind/named.conf.local and make some few changes. The changes that have been added to the file are highlighted in bold.
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
include "/etc/bind/rndc.key";
controls {
inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; };
};
zone "debian.lan" {
type master;
file "db.debian.lan";
allow-update { key "rndc-key"; };
};
zone "100.168.192.in-addr.arpa" {
type master;
file "db.192.168.100";
allow-update { key "rndc-key"; };
};
Install and configure dhcp3-server
vi /etc/default/dhcp3-server
Configure which interface the dhcpd server should listen to. I this case, I assume that our LAN interface is "eth1".
# Defaults for dhcp initscript # sourced by /etc/init.d/dhcp # installed at /etc/default/dhcp3-server by the maintainer scripts # # This is a POSIX shell fragment # # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACES="eth1"
Then we will configure the dhcp configuration file, create a backup of the file /etc/dhcp3/dhcpd.conf and edit it.
vi /etc/dhcp3/dhcpd.conf
Make sure the configuration file should be exactly the same like this:
ddns-update-style interim;
ignore client-updates;
include "/etc/bind/rndc.key";
zone debian.lan. {
primary 127.0.0.1;
key "rndc-key";
}
authoritative;
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.2 192.168.100.3;
option domain-name-servers 192.168.100.1;
option domain-name "debian.lan";
option routers 192.168.100.1;
default-lease-time 600;
max-lease-time 7200;
zone main.debian.lan. {
primary 192.168.100.1;
key "rndc-key";
}
zone 100.168.192.in-addr.arpa. {
primary 192.168.100.1;
key "rndc-key";
}
}
Restart the DNS server and the DHCP server.
/etc/init.d/dhcp3-server restart
Your DDNS server should be ok. Now, if your client in your LAN is Ubuntu, you need to edit the file /etc/dhcp3/dhclient.conf.
Add the following information
send host-name "pc-name";
and run this command to renew your ip address and domain name.
If you are using Fedora, CentOS or RHEL, edit the file
append the hostname
DHCP_HOSTNAME=centos
and restart the network service.
Test your client domain name using dig or nslookup command:
the command will return the following message:
Server: 192.168.100.1 Address: 192.168.100.1#53 Name: ubuntu01.debian.lan Address: 192.168.100.2
Check the reverse dns
the command will return the following message:
Server: 192.168.100.1 Address: 192.168.100.1#53 2.100.168.192.in-addr.arpa name = ubuntu01.debian.lan.
Have fun!
Related Posts
- How to setup a LAN DNS server using Bind9 under Debian and Ubuntu Linux
- Create Self-signed SSL Certifcate using OpenSSL for testing purposes in Debian/Ubuntu
- Apache2 name-based virtual hosting on Debian/Ubuntu
- Howto build a Wifi Hotspot using Chillispot and Debian Etch
- Installing Openfire in Debian Etch


Delicious
Digg
StumbleUpon
Furl
Facebook
Twitter
Google
Yahoo
Buzz Up!
LinkedIn
Technorati



Comments
Great Tutorial
One misstake:
You should say that you have to change the rights of
/etc/bind/rndc.key
or Copy it to /etc/dhcp3/rndc.key
after working about one day on your solution i discovered, that many problems have their solution within apparmor. I'm was very
suppriesed that many people on the net just turning apparmor off
instead of dealing with it and leaning the new technics. Perhaps
you can write some more Details about DNS/DHCP and DDNS within the "Monster" apparmor. Well, the last failure on my side was a
misconfiguration of the apparmor-File from the bind9. bind9 wasn't able to create or change the jnl-Files in the chrooted /etc/bind folder. A simple change from the permission "r" to "rw" in that file was the solution. take care
that if you have changed the apparmor file to do a: /etc/init.d/apparmord reload an then restart apparmor again, and as you said: Have fun ;-)) ... Thanks for the very good work !
is it ubuntu version or debian! or the retail of two of it?
i just get used to use debian! is there both the same?
sorry for many quetions!
Post new comment