<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sohail Riaz, Linux and Open Source Blog &#187; DHCP</title>
	<atom:link href="http://www.sohailriaz.com/category/dhcp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sohailriaz.com</link>
	<description>Sohail Riaz, Linux and Open Source Blog</description>
	<lastBuildDate>Sat, 17 Jul 2010 07:38:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How To Configure Dynamic DNS (Fedora Core 4 Setup)</title>
		<link>http://www.sohailriaz.com/how-to-configure-dynamic-dns-fedora-core-4-setup/</link>
		<comments>http://www.sohailriaz.com/how-to-configure-dynamic-dns-fedora-core-4-setup/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 11:21:40 +0000</pubDate>
		<dc:creator>Sohail Riaz</dc:creator>
				<category><![CDATA[DHCP]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[BIND]]></category>

		<guid isPermaLink="false">http://www.sohailriaz.com/?p=9</guid>
		<description><![CDATA[<a href="http://www.sohailriaz.com/how-to-configure-dynamic-dns-fedora-core-4-setup/"><img src=""  alt="" title="" /></a>
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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.<span id="more-9"></span></p>
<h3>1 Installation of Packages</h3>
<p>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.</p>
<blockquote><p>yum –y install bind bind-chroot bind-utils bind-libs caching-nameserver dhcp</p></blockquote>
<p>where</p>
<p><span class="system">bind</span> &#8212;&#8211;    DNS Server Package<br />
<span class="system"> bind-chroot</span> &#8212;&#8211;     DNS runs in chroot (jail) environment.<br />
<span class="system"> bind-libs</span> &#8212;&#8211;    Libraries needed in using bind, bind-utils<br />
<span class="system"> bind-utils</span> &#8212;&#8211;    Contains utilities like nslookup, host, dig etc.<br />
<span class="system"> caching-nameserver</span> &#8212;&#8211;    give caching capabilities to store records in cache.<br />
<span class="system">dhcp</span> &#8212;&#8211; Dynamic Host Configuration Protocol Package.</p>
<h3>2 Configuring BIND (DNS)</h3>
<p>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 <span class="system">rndckey</span> is a file containing a shared secret, so that BIND knows that it is an approved application sending instructions.</p>
<blockquote><p>vi /etc/named.conf</p></blockquote>
<blockquote><p>controls {<br />
inet 127.0.0.1 allow {localhost; } keys { &#8220;rndckey&#8221;; };<br />
};<br />
// Add local zone definitions here.<br />
zone &#8220;example.com&#8221; {<br />
type master;<br />
file &#8220;example.com.zone&#8221;;<br />
allow-update { key &#8220;rndckey&#8221;; };<br />
notify yes;<br />
};<br />
zone &#8220;0.168.192.in-addr.arpa&#8221; {<br />
type master;<br />
file &#8220;0.168.192.in-addr.arpa.zone&#8221;;<br />
allow-update { key &#8220;rndckey&#8221;; };<br />
notify yes;<br />
};</p>
<p>include &#8220;/etc/bind/rndc.key&#8221;;</p></blockquote>
<p>The secret key is created at the installation time. No need to do anything here but….<br />
<strong> Note:</strong> 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. <span class="system">/etc/rndc.key</span>.</p>
<h4>2.1  Zone Files</h4>
<p>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.</p>
<blockquote><p>vi /var/named/chroot/var/named/example.com.zone</p></blockquote>
<blockquote><p>$TTL 86400<br />
@       IN      SOA     @ root (<br />
50 ; serial<br />
28800 ; refresh (8 hours)<br />
7200 ; retry (2 hours)<br />
604800 ; retire (1 week)<br />
86400 ; ttl (1 day)<br />
)<br />
IN      NS      server<br />
server     IN      A       192.168.0.1</p></blockquote>
<blockquote><p>vi /var/named/chroot/var/named/0.168.192.in-addr.arpa.zone</p></blockquote>
<blockquote><p>$TTL 86400<br />
@       IN      SOA     @ root (<br />
50 ; serial<br />
28800 ; refresh (8 hours)<br />
7200 ; retry (2 hours)<br />
604800 ; retire (1 week)<br />
86400 ; ttl (1 day)<br />
)<br />
IN      NS      server<br />
1      IN   PTR    server.example.com.</p></blockquote>
<p>Now make shortcuts of these files in the <span class="system">/var/named</span> directory with the same name.</p>
<blockquote><p>cd /var/named<br />
ln –s /var/named/chroot/var/named/example.com.zone example.com.zone<br />
ln –s /var/named/chroot/var/named/0.168.192.in-addr.arpa.zone 0.168.192.in-addr.arpa.zone</p></blockquote>
<h3>3 Configuring DHCP Server</h3>
<p>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:</p>
<blockquote><p>vi /etc/dhcpd.conf</p></blockquote>
<blockquote><p># This is the communication zone</p>
<p>zone example.com. {<br />
primary 127.0.0.1;<br />
key rndckey;<br />
}</p>
<p>default-lease-time      21600;  # 6 hours<br />
max-lease-time          43200;  # 12 hours</p>
<p># Client configuration:</p>
<p>option domain-name      &#8220;example.com.&#8221;;<br />
option ip-forwarding    off;</p>
<p>subnet 192.168.0.0 netmask 255.255.255.0 {<br />
range 192.168.0.100 192.168.0.200;<br />
option routers                  192.168.0.1;  # default gateway<br />
option subnet-mask              255.255.255.0;<br />
option broadcast-address        192.168.0.255;<br />
option domain-name-servers      192.168.0.1;</p>
<p>zone  0.168.192.in-addr.arpa. {<br />
primary 192.168.0.2;<br />
key rndckey;<br />
}</p>
<p>zone localdomain. {<br />
primary 192.168.0.2;<br />
key rndckey;<br />
}</p>
<p>}</p></blockquote>
<p>Now execute the following change permission commands to enable named user to write the zone files whenever an name with IP updating is required.</p>
<blockquote><p>chmod 770 /var/named/chroot/var/named<br />
chmod 770 /var/named</p></blockquote>
<p>Now start the services of dns and dhcp with the following command:</p>
<blockquote><p>service named start<br />
service dhcp start</p></blockquote>
<p>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.</p>
<blockquote><p>nslookup yourcomputername.example.com</p></blockquote>
<p>Good Luck with your newly created Dynamic DNS Server.</p>
<img src="http://www.sohailriaz.com/wp-content/plugins/pixelstats/trackingpixel.php?post_id=9&amp;ts=1284149714" style="display:none;" alt="pixelstats trackingpixel"/>]]></content:encoded>
			<wfw:commentRss>http://www.sohailriaz.com/how-to-configure-dynamic-dns-fedora-core-4-setup/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>
