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!

Delicious
Digg
StumbleUpon
Technorati














Post new comment