-
11
Nov
In this howto we will learn how to build a Dynamic DNS Server. Normally when we configure DNS, we use static entries to resolve any FQDN. If we are using DHCP in our network which gives dynamic IPs to every computer that turns on or requests one, then it is not possible to configure DNS statically. For that we should configure our DNS with DHCP in a manner that whenever a computer gets a new IP, its FQDN will be automatically updated with the new IP in DNS.
1 Installation of Packages
Fedora Core 4 contains a DNS (Bind) and DHCP (dhcp) packages in its CDs. You can install it from the Fedora Core 4 CDs or download it from the internet using following command.
yum –y install bind bind-chroot bind-utils bind-libs caching-nameserver dhcp
where
bind —– DNS Server Package
bind-chroot —– DNS runs in chroot (jail) environment.
bind-libs —– Libraries needed in using bind, bind-utils
bind-utils —– Contains utilities like nslookup, host, dig etc.
caching-nameserver —– give caching capabilities to store records in cache.
dhcp —– Dynamic Host Configuration Protocol Package.
2 Configuring BIND (DNS)
You need to tell BIND that it is okay to allow other applications to update it. I added the following to my BIND configuration, everything else was left as stock Fedora Core 4. Here is my local zone details, suitably modified. Here I let BIND know which domains it can update; in my case I only have one domain to deal with. I am also loading the shared secret key at this stage. My DHCP server and DNS server are on the same box, so here I am only allowing localhost to perform the update. The file rndckey is a file containing a shared secret, so that BIND knows that it is an approved application sending instructions.
vi /etc/named.conf
controls {
inet 127.0.0.1 allow {localhost; } keys { “rndckey”; };
};
// Add local zone definitions here.
zone “example.com” {
type master;
file “example.com.zone”;
allow-update { key “rndckey”; };
notify yes;
};
zone “0.168.192.in-addr.arpa” {
type master;
file “0.168.192.in-addr.arpa.zone”;
allow-update { key “rndckey”; };
notify yes;
};include “/etc/bind/rndc.key”;
The secret key is created at the installation time. No need to do anything here but….
Note: If your DHCP and DNS servers are on separate machines you need to copy the file between them. Both machines should use the same file i.e. /etc/rndc.key.
2.1 Zone Files
Set up your zone databases as normal. You do not need to do anything fancy. Because our DHCP server will update zone files as the new IP allocated to our workstation.
vi /var/named/chroot/var/named/example.com.zone
$TTL 86400
@ IN SOA @ root (
50 ; serial
28800 ; refresh (8 hours)
7200 ; retry (2 hours)
604800 ; retire (1 week)
86400 ; ttl (1 day)
)
IN NS server
server IN A 192.168.0.1
vi /var/named/chroot/var/named/0.168.192.in-addr.arpa.zone
$TTL 86400
@ IN SOA @ root (
50 ; serial
28800 ; refresh (8 hours)
7200 ; retry (2 hours)
604800 ; retire (1 week)
86400 ; ttl (1 day)
)
IN NS server
1 IN PTR server.example.com.
Now make shortcuts of these files in the /var/named directory with the same name.
cd /var/named
ln –s /var/named/chroot/var/named/example.com.zone example.com.zone
ln –s /var/named/chroot/var/named/0.168.192.in-addr.arpa.zone 0.168.192.in-addr.arpa.zone
3 Configuring DHCP Server
By default the DHCP server shipped in Fedora Core 4 does not do dynamic DNS update. You simply need to enable it. Below are the options I selected for my system. My dhcp configuration is as follows:
vi /etc/dhcpd.conf
# This is the communication zone
zone example.com. {
primary 127.0.0.1;
key rndckey;
}default-lease-time 21600; # 6 hours
max-lease-time 43200; # 12 hours# Client configuration:
option domain-name “example.com.”;
option ip-forwarding off;subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.200;
option routers 192.168.0.1; # default gateway
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option domain-name-servers 192.168.0.1;zone 0.168.192.in-addr.arpa. {
primary 192.168.0.2;
key rndckey;
}zone localdomain. {
primary 192.168.0.2;
key rndckey;
}}
Now execute the following change permission commands to enable named user to write the zone files whenever an name with IP updating is required.
chmod 770 /var/named/chroot/var/named
chmod 770 /var/named
Now start the services of dns and dhcp with the following command:
service named start
service dhcp start
Go to your client computers and enable them to take an IP from a DHCP server. With the following command check if your client computer name is updated in DNS. It will resolve your name with the newly allocated IP.
nslookup yourcomputername.example.com
Good Luck with your newly created Dynamic DNS Server.
- Published by Sohail Riaz in: DHCP DNS
- If you like this blog please take a second from your precious time and subscribe to my rss feed!











8 Responses to “How To Configure Dynamic DNS (Fedora Core 4 Setup)”
how to bind macaddress and ip in dhcp??
You have to define a configuration in your dhcpd.conf like this before last }
host machine1 {
hardware ethernet XX:XX:XX:XX:XX:XX;
fixed-address 192.XXX.XXX.XXX;
}
Where machine1 can be any name, make it suitable for you to identify the computer and replace XX with appropriate data.
Regards,
i have done for a single ip & mac…the its done….but when i have doing for 2nd ip & mac,….then its failed
Again do the same
##############
host machine2 {
hardware ethernet YY:YY:YY:YY:YY:YY;
fixed-address 192.YYY.YYY.YYY;
}
#############
Where machine2 can be any name, make it suitable for you to identify the computer and replace YY with appropriate value.
Regards,
ya….thank u sir….its done….
hi,,sir….i want to configure my NIS client on fedora 10…so plz can u tell me how i configure my NIS client in fedora….i have configured NIS client on RHEL5 but problem in Fedora 10.. i am not getting proepr file..where i do entry?
Its in
/etc/ypbind.conf
Just to define your NIS server address in it and restart ypbind service.
Regards,
Hello Sir!
can you please tell me how to configure DNS server in RHEL 5. i am new to linux and i have tried to configure it but i dont know what exactly to do. i can find the file called named.conf. please tell me how to install it and configure it. i will be very thankful to you for this.
Leave a Reply