====== OpenNic ====== OpenNic ist ein privates Network Information Center und alternatives DNS System - mehr Informationen finden Sie bei [[http://de.wikipedia.org/wiki/OpenNIC|Wikipedia]] und auf der [[http://www.opennicproject.org/|Projektseite]]. Ich möchte hier die Einrichtung eines T2 DNS-Server unter Ubuntu 9.10 (64-bit Server) beschreiben.\\ \\ ==== Bind Installieren ==== apt-get install bind9 da Bind noch nicht konfiguriert ist stoppen wir den Dienst sofort. /etc/init.d # bind9 stop ===== Konfigurationsdateien anpassen ===== ==== named.conf.default-zones ==== /etc/bind # nano named.conf.default-zones // prime the server with knowledge of the root servers //zone "." { // type hint; // file "/etc/bind/db.root"; //}; zone "." { type slave; file "opnnenic.root"; masters { 58.6.115.45;58.6.115.46;66.244.95.11;207.192.71.13;128.177.28.254;66.96.213.86;216.87.84.214;206.225.16.60; }; allow-transfer { any; }; notify no; }; // be authoritative for the localhost forward and reverse zones, and for // broadcast zones as per RFC 1912 zone "localhost" { type master; file "/etc/bind/db.local"; }; zone "127.in-addr.arpa" { type master; file "/etc/bind/db.127"; }; zone "0.in-addr.arpa" { type master; file "/etc/bind/db.0"; }; zone "255.in-addr.arpa" { type master; file "/etc/bind/db.255"; }; Die Ablage der Datei "opennic.root" erfolgt unter "/var/cache/bind" - das ist unter Ubuntu das Arbeits-Verzeichnis des named Servers dameon ! Daher muss hier kein Verzeichnispfad angegeben werden, an dieser Stelle ist keine Änderung apparmor Profiles notwendig. Siehe [[http://ubuntuforums.org/showthread.php?t=1089473|Ubuntuforums.org]] ==== named.conf.options ==== /etc/bind # nano named.conf.options options { directory "/var/cache/bind"; // If there is a firewall between you and nameservers you want // to talk to, you may need to fix the firewall to allow multiple // ports to talk. See http://www.kb.cert.org/vuls/id/800113 // If your ISP provided one or more IP addresses for stable // nameservers, you probably want to use them as forwarders. // Uncomment the following block, and insert the addresses replacing // the all-0's placeholder. // forwarders { // 0.0.0.0; // }; auth-nxdomain no; # conform to RFC1035 allow-recursion { any; }; allow-query { any; }; allow-query-cache { any; }; listen-on-v6 { none; }; }; IP-V6 ist deaktiviert, die Einträge allow-recursion, allow-query, allow-query-cache sind notwendig damit von "außen" DNS An/Abfragen zulässig sind - Teilweise habe ich diese Informationen dem Thread bei [[http://www.howtoforge.com/forums/showthread.php?p=133474|howtoforge.com]] entnommen. ==== named.conf.local ==== /etc/bind # nano named.conf.local // // Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; logging { channel "misc" { file "/var/log/named.log" versions 3 size 1M; severity info; print-severity no; print-category yes; print-time yes; }; channel "querylog" { file "/var/log/query.log"; severity info; print-severity no; print-category no; print-time yes; }; category "queries" { "querylog"; }; category default { "misc"; }; }; ==== Logging Rotation ==== Das Logging ist so konfiguriert das über Logrotate die Query-Logfiles täglich "rotiert" und gepackt werden. Siehe [[https://answers.launchpad.net/ubuntu/+source/bind9/+question/43187]] Erzeugen Sie dazu folgende Datei: sudo nano /etc/logrotate.d/bind9_query /var/log/query.log { daily rotate 14 compress delaycompress missingok notifempty create 0664 bind root postrotate /etc/init.d/bind9 reload > /dev/null endscript } **Die Logging Konfiguration ist noch eine ziemliche Baustelle, für Ergänzungen und Anregungen bin ich dankbar.** Danach noch folgende Anpassungen vornehmen: //sudo touch /var/log/named.log //sudo chown bind /var/log/named.log //sudo touch /var/log/query.log //sudo chown bind /var/log/query.log // edit /etc/apparmor.d/usr.sbin.named and add: ///var/log/named.log rw, ///var/log/query.log rw, //etc/init.d ./apparmor reload Danach bind starten /etc/init.d # bind9 start Wenn bind ohne Fehlermeldung startet können wir den DNS-Server testen. Tragen Sie den Server als DNS Server in Ihrem System ein - unter Linux/Unix/OSX sollte "dig" folgende Ausgabe erzeugen: ; <<>> DiG 9.6.0-APPLE-P2 <<>> ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22536 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 7 ;; QUESTION SECTION: ;. IN NS ;; ANSWER SECTION: . 518400 IN NS ns21.opennic.glue. . 518400 IN NS ns5.opennic.glue. . 518400 IN NS ns4.opennic.glue. . 518400 IN NS ns22.opennic.glue. . 518400 IN NS ns7.opennic.glue. . 518400 IN NS ns6.opennic.glue. . 518400 IN NS ns2.opennic.glue. ;; ADDITIONAL SECTION: ns2.opennic.glue. 9297 IN A 216.87.84.214 ns4.opennic.glue. 9297 IN A 84.200.228.200 ns5.opennic.glue. 9297 IN A 128.177.28.254 ns6.opennic.glue. 9297 IN A 207.192.71.13 ns7.opennic.glue. 9297 IN A 66.244.95.11 ns21.opennic.glue. 9297 IN A 58.6.115.46 ns22.opennic.glue. 9297 IN A 58.6.115.45 ;; Query time: 38 msec ;; SERVER: 78.46.76.146#53(78.46.76.146) ;; WHEN: Fri Oct 22 23:28:47 2010 ;; MSG SIZE rcvd: 262 ==== Monitoring ==== Zu einem Server gehört natürlich auch ein Monitoring-System, schließlich möchte man ja wissen was auf der Kiste so passiert.....8-), als Monitoring-Software wird [[http://munin-monitoring.org/|Munin]] verwendet, für Munin spricht die (relativ) einfache Konfiguration und die vielen guten Tutorials und Anleitungen im Internet. Da sich das Monitoring nicht nur auf den DNS-Server "bind" beschränkt wird es gesondert beschrieben - das "Bind" Logging wird [[:munin_bind9|hier beschrieben.]]