<?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>Sebastian Mogilowskis Blog &#187; bind9</title>
	<atom:link href="http://www.mogilowski.net/lang/de-de/tag/bind9/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mogilowski.net</link>
	<description>Just another blog about administration, linux and other stuff</description>
	<lastBuildDate>Tue, 17 Jan 2012 13:42:30 +0000</lastBuildDate>
	<language>de-de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Debian Router Installation &#8211; Teil 2 (DHCP)</title>
		<link>http://www.mogilowski.net/lang/de-de/2008/05/07/debian-router-installation-teil-2-dhcp</link>
		<comments>http://www.mogilowski.net/lang/de-de/2008/05/07/debian-router-installation-teil-2-dhcp#comments</comments>
		<pubDate>Wed, 07 May 2008 11:08:11 +0000</pubDate>
		<dc:creator>sebastian</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bind9]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[etch]]></category>
		<category><![CDATA[router]]></category>

		<guid isPermaLink="false">http://www.mogilowski.net/?p=16</guid>
		<description><![CDATA[DIeser Artikel beschreibt wie man einen DNS und DHCP Server mit 2 Subnetzen mit RNDC-Key Authentifizierung unter Debian Etch installiert: Der bereits erwähnte Debian Router soll nun um einen DHCP Server erweitert werden. Der DNS Server wurde bereits im ersten Teil der Debian Router Installation installiert. Er muss nun noch konfiguriert werden. Dabei sollen 2 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>DIeser Artikel beschreibt wie man einen DNS und DHCP Server mit 2 Subnetzen mit RNDC-Key Authentifizierung unter Debian Etch installiert:</strong></p>
<p>Der bereits erwähnte Debian Router soll nun um einen DHCP Server erweitert werden. Der DNS Server wurde bereits im <a href="http://www.mogilowski.net/?p=11">ersten Teil</a> der Debian Router Installation installiert. Er muss nun noch konfiguriert werden.</p>
<p>Dabei sollen 2 Subnetze angelegt werden, ein sicheres (192.168.0.0) sowie ein Subnetz für Gäste (192.168.1.0)</p>
<p>Die Konfiguration des DHCP und DNS Servers erfolgt am einfachsten mit Webmin. Leider ist das Standard Webmin DNS Modul dafür nur bedingt geeignet. Man sollte sich das Bind9 Webmin Modul herrunterladen und installieren. (<a title="b9ddns" href="http://sourceforge.net/projects/b9ddns" target="_blank">http://sourceforge.net/projects/b9ddns</a>)</p>
<p>Nun kann man unter Webmin im Menü &#8220;Server&#8221; den DNS Server unter &#8220;BIND 9 dynamic DNS Server&#8221; den DNS Server konfigurieren:</p>
<p>Zuerst müssen drei neue &#8220;Master Zones&#8221; angelegt werden:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">Zone type:                      Forward</span>
<span style="font-size: x-small;">Domain name / IP subnet:        network.lan</span>
<span style="font-size: x-small;">Master server:                  ROUTER.</span>
<span style="font-size: x-small;">Email address:                  root@localhost</span>

<span style="font-size: x-small;">Zone type:                      Reverse</span>
<span style="font-size: x-small;">Domain name / IP subnet:        192.168.0
</span><span style="font-size: x-small;">Master server:                  ROUTER.</span>
<span style="font-size: x-small;">Email address:                  root@localhost</span>

<span style="font-size: x-small;">Zone type:                      Reverse</span>
<span style="font-size: x-small;">Domain name / IP subnet:        192.168.1</span>
<span style="font-size: x-small;">Master server:                  ROUTER.</span>
<span style="font-size: x-small;">Email address:                  root@localhost</span></pre>
<p>Nun muss man diese Zonen in dynamische Zonen umwandeln. Dies ist notwendig, damit der DHCP Server die Informationen des DNS Servers aktualisieren kann. Dazu wird unter &#8220;Access Controll List&#8221; eine neue &#8220;ACL&#8221; angelegt.</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">Name:                   dhcp</span>
<span style="font-size: x-small;">Matching addresses:     127.0.0.1
                        192.168.0.1
                        192.168.1.1</span></pre>
<p>In jeder Zone kann man nun unter &#8220;Edit Zone Options&#8221; <strong>dhcp</strong> in das Feld &#8220;Allow updates from &#8230;&#8221; eintragen. Der Titel &#8220;<em>Static Master Zone</em>&#8221; sollte sich nun in &#8220;<em>Dynamic Master Zone</em>&#8221; geändert haben.</p>
<p>Nun kann man die <strong>/etc/resolv.conf</strong> Datei anpassen. Dort sollten aktuell die Nameserver des Providers eingetragen sein, diese können entfernt werden und durch diesen Eintrag ersetzt werden:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">nameserver 127.0.0.1</span>
<span style="font-size: x-small;">search network.lan</span></pre>
<p>Jetzt muss natürlich verhindert werden, das bei der nächsten ppp Einwahl wieder die Nameserver des Providers eingetragen werden. Dazu editiert man die Datei <strong>/etc/ppp/peers/dsl-provider</strong> und kommentiert den Eintrag &#8220;usepeerdns&#8221; aus.</p>
<p>Da der Router selbst natürlich seine IP Adressen nicht dynamisch vom DHCP Server bezieht (lokal), muss er manuell im DNS Server hinterlegt werden. Dazu bearbeitet man die &#8220;Master Zone&#8221; &#8220;network.lan&#8221;. Unter dem Menüpunkt &#8220;Address&#8221; kann man manuell einen &#8220;Address Record&#8221; hinzufügen:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">Name:                   ROUTER</span>
<span style="font-size: x-small;">Address:                192.168.0.1</span>
<span style="font-size: small;"><span style="font-size: x-small;">Create reverse record?: Yes or update existing</span>  </span></pre>
<p>Damit wäre der DNS Server soweit konfiguriert und man kann sich nun den DHCP Server vornehmen.</p>
<p>Installation:</p>
<pre style="margin-bottom: 0.5cm; line-height: 100%; text-align: justify;"><span style="font-size: x-small;">aptitude install dhcp3-server</span></pre>
<p>Die Konfiguration erfolgt nun wieder mit Hilfe von Webmin. Diese ist in Webmin unter &#8220;Servers &#8211; &#62; DHCP Server&#8221; zu finden.</p>
<p>Wie bereits erwähnt, soll das Subnetz 192.168.0.0 als sicheres Subnetz dienen. Das heißt es sollen nur bekannte Clients und Server eine IP Adresse vom DHCP Server erhalten. Jeder dieser bekannten Clients und Server muss unter &#8220;Hosts&#8221; einzeln angelegt werden:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">Hostname: TESTCLIENT</span>
<span style="font-size: x-small;">Hardware : XX:XX:XX:XX:XX:XX</span></pre>
<p>Als nächstes müssen die entsprechenden Subnetze angelegt werden:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">Network address:                              192.168.0.0</span>
<span style="font-size: x-small;">Netmask:                                      255.255.255.0</span>
<span style="font-size: x-small;">Address ranges:                               192.168.0.100 - 192.168.0.200</span>
<span style="font-size: x-small;">Dynamic DNS enabled?:                         Yes</span>
<span style="font-size: x-small;">Dynamic DNS reverse domain:                   0.168.192.in-addr.arpa</span>
<span style="font-size: x-small;">Dynamic DNS domain name:                      network.lan</span>
<span style="font-size: x-small;">Server is authoritative for this subnet?:     Yes</span>
<span style="font-size: x-small;">Allow unknown clients?:                       Ignore</span>
<span style="font-size: x-small;">Hosts directly in this subnet:                TESTCLIENT</span>

<span style="font-size: x-small;">Network address:                              192.168.1.0</span>
<span style="font-size: x-small;">Netmask:                                      255.255.255.0</span>
<span style="font-size: x-small;">Address ranges:                               192.168.1.100 - 192.168.1.200</span>
<span style="font-size: x-small;">Dynamic DNS enabled?:                         Yes</span>
<span style="font-size: x-small;">Dynamic DNS reverse domain:                   1.168.192.in-addr.arpa</span>
<span style="font-size: x-small;">Dynamic DNS domain name:                      network.lan</span>
<span style="font-size: x-small;">Server is authoritative for this subnet?:     Yes</span>
<span style="font-size: x-small;">Allow unknown clients?:                       Allow</span></pre>
<p>Außerdem muss man die globalen Clienteinstellungen unter &#8220;Edit Client Options&#8221; anpassen:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">Domain name: network.lan</span>
<span style="font-size: x-small;">DNS servers: 192.168.0.1 192.168.1.1</span>
<span style="font-size: x-small;">Dynamic DNS enabled? Yes</span>
<span style="font-size: x-small;">Dynamic DNS update style: Interim</span>
<span style="font-size: x-small;">Allow unknown clients?: Ignore</span></pre>
<p>Zum Schluß müssen noch die entsprechenden dynamischen Zonen, welche im DNS Server angelegt wurden, im DHCP Server eingetragen werden. Dies geschieht über &#8220;Add a new DNS zone&#8221;:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">Name of zone:           network.lan</span>
<span style="font-size: x-small;">IP of primary NS:       127.0.0.1</span>

<span style="font-size: x-small;">Name of zone:           0.168.192.in-addr.arpa</span>
<span style="font-size: x-small;">IP of primary NS:       127.0.0.1</span>

<span style="font-size: x-small;">Name of zone:           1.168.192.in-addr.arpa</span>
<span style="font-size: x-small;">IP of primary NS:       127.0.0.1</span></pre>
<p>Unter &#8220;Configfile&#8221; kann man sich nun die entsprechend erzeugten Einträge ansehen. Hier muss man die &#8220;zone&#8221; Einträge suchen und die &#8220;key ;&#8221; Zeilen auskommentieren. Auf diese Einträge werden wir später noch eingehen.</p>
<p>Jetzt fehlen nur noch die entsprechenden Rechte und man kann DNS und DHCP Server mit der neuen Konfiguration starten:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">chmod g+w /etc/bind</span>
<span style="font-size: x-small;">/etc/init.d/bind9 restart</span>
<span style="font-size: x-small;">/etc/init.d/dhcp3-server restart</span></pre>
<p>Mit &#8220;dhclient eth0&#8243; kann man nun auf dem Testclient eine IP-Adresse vom DHCP Server anfordern. Diese sollte man auch im Webmin unter &#8220;DHCP Leases&#8221; einsehen können. Zusätzlich sollte im DNS Server auch in jeder der drei angelegten Zonen unter &#8220;Address&#8221; ein Eintrag mit dem Namen und der Adresse des Testclients angelegt worden sein.</p>
<p>Nun wollen wir auf die &#8220;key&#8221; Einträge zurückkommen. Diese dienen dazu die Verbindung zwischen DNS und DHCP Server weiter abzusichern. Im Syslog findet man aktuell noch Einträge dieser Art:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">named[30576]: zone 'network.lan' allows updates by IP address, which is insecure</span>
<span style="font-size: x-small;">named[30576]: zone '0.168.192.in-addr.arpa' allows updates by IP address, which is insecure</span>
<span style="font-size: x-small;">named[30576]: zone '1.168.192.in-addr.arpa' allows updates by IP address, which is insecure</span></pre>
<p>Dies liegt daran, dass die Authentifizierung anhand einer ACL, welche beim DNS Server eingerichtet wurde funktioniert. (siehe Beginn des Artikels) Diese Methode ist einfacher, und ist für die ersten Funktionstests ausreichend. Nun soll sie durch eine RNDC-Key Authentifizierung ersetzt werden. Der dafür notwendige Schlüssel wurde bereits bei der &#8220;bind9&#8243; installation automatisch erzeugt und in der Datei <strong>/etc/bind/rndc.key </strong>gespeichert. Zuerst muss dieser Key nun kopiert werden:</p>
<pre style="margin-bottom: 0.5cm; line-height: 100%; text-align: justify;"><span style="font-size: x-small;">cp /etc/bind/rndc.key /etc/rndc.conf</span></pre>
<p>Danach wird die Datei <strong>/etc/rndc.conf </strong>bearbeitet, sodass sie folgendes Aussehen hat:</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">key "rndc-key" {</span>
    <span style="font-size: x-small;">algorithm hmac-md5;</span>
    <span style="font-size: x-small;">secret "HERE_IS_YOUR_OWN_KEY";</span>
<span style="font-size: x-small;">};</span>
<span style="font-size: x-small;">options {</span>
    <span style="font-size: x-small;">default-server localhost;</span>
    <span style="font-size: x-small;">default-key "rndc-key";</span>
<span style="font-size: x-small;">};</span></pre>
<p>Nun muss dieser Schlüssel in die Datei <strong>/etc/bind/named.conf</strong> eingebunden werden. Dazu muss zuerst der entsprechende ACL-Eintrag</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">acl dhcp {</span>
    <span style="font-size: x-small;">127.0.0.1;</span>
    <span style="font-size: x-small;">192.168.0.1;</span>
    <span style="font-size: x-small;">192.168.1.1;</span>
<span style="font-size: x-small;">};</span></pre>
<p>entfernt werden und durch den Schlüsseleintrag ersetzt werden.</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">include "/etc/bind/rndc.key";</span>
<span style="font-size: x-small;">controls {</span>
    <span style="font-size: x-small;">inet 127.0.0.1 allow {localhost;} keys {rndc-key;};</span>
<span style="font-size: x-small;">};</span></pre>
<p>Danach muss bei jeder Zone im DNS Server der Eintrag</p>
<pre style="margin-bottom: 0.5cm; line-height: 100%; text-align: justify;"><span style="font-size: x-small;">allow-update { dhcp; };</span></pre>
<p>durch diesen ersetzt werden</p>
<pre style="margin-bottom: 0.5cm; line-height: 100%; text-align: justify;"><span style="font-size: x-small;">allow-update { key "rndc-key"; };</span></pre>
<p>Nun kann man auch den DHCP Server auf die neue authentifizierung anpassen indem man folgende Zeile in der Datei <strong>/etc/dhcp3/dhcpd.conf</strong> hinzufügt:</p>
<pre style="margin-bottom: 0.5cm; line-height: 100%; text-align: justify;"><span style="font-size: x-small;">include "/etc/bind/rndc.key";</span></pre>
<p>Die vorher auskommentierten &#8220;key ;&#8221; Einträge werden nun durch</p>
<pre style="line-height: 150%; text-align: justify;"><span style="font-size: x-small;">key rndc-key ;</span></pre>
<p>ersetzt.</p>
<p>Zum Schluss muss man nur noch DHCP und DNS Server neu starten</p>
<pre style="line-height: 100%; text-align: justify;"><span style="font-size: x-small;">/etc/init.d/bind9 restart</span>
<span style="font-size: x-small;">/etc/init.d/dhcp3-server restart

</span></pre>
<p style="line-height: 100%;" align="justify"><span style="font-size: small;"><span style="font-size: x-small;"> </span></span></p>
<p><strong> Links:</strong></p>
<p style="line-height: 100%;" align="justify"><span style="font-size: small;"><span style="font-size: x-small;"><a title="http://www.linux-home-server.de" href="http://www.linux-home-server.de" target="_blank">http://www.linux-home-server.de</a><br />
<a title="http://wiki.slashconcept.com/index.php/BIND_9_DNS_Server_unter_Debian_GNU_Linux_4.0_Etch_Howto_(LAN)" href="http://wiki.slashconcept.com/index.php/BIND_9_DNS_Server_unter_Debian_GNU_Linux_4.0_Etch_Howto_(LAN)" target="_blank">http://wiki.slashconcept.com/index.php/BIND_9_DNS_Server_unter_Debian_GNU_Linux_4.0_Etch_Howto_(LAN)</a><br />
<a title="http://linuxwiki.de/debian-dhcp" href="http://linuxwiki.de/debian-dhcp" target="_blank">http://linuxwiki.de/debian-dhcp</a><br />
<a title="http://www.howtoforge.com/dhcp_server_linux_debian_sarge" href="http://www.howtoforge.com/dhcp_server_linux_debian_sarge" target="_blank">http://www.howtoforge.com/dhcp_server_linux_debian_sarge</a><br />
<a title="http://www.schoki.org/ddns/ddns.html " href="http://www.schoki.org/ddns/ddns.html " target="_blank">http://www.schoki.org/ddns/ddns.html </a></span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mogilowski.net/lang/de-de/2008/05/07/debian-router-installation-teil-2-dhcp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Database Caching 17/34 queries in 0.019 seconds using apc
Object Caching 487/499 objects using apc
Content Delivery Network via cdn.mogilowski.net

Served from: www.mogilowski.net @ 2012-02-05 02:14:00 -->
