This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

BIND/Guide

From Gentoo Wiki (test)
< BIND
Jump to:navigation Jump to:search
This page is a translated version of the page BIND/Guide and the translation is 74% complete.

This guide teaches the reader how install and configure BIND for a domain and a local network.

Giriş

This tutorial will show you how to install and configure BIND, the most used DNS server on Internet. We will configure BIND for a domain using different configurations, one for a local network and one for the rest of the world. Two views will be used to do so:

  1. View of the internal zone (your local network).
  2. View for the external zone (rest of the world).

Örneklerde kullanılacak veri

Anahtar kelime Tanım Örnek
ALAN_ADINIZ Sahip olduğunuz alan adı gentoo.org
DIŞ_IP İnternet servis sağlayıcınızın size verdiği IP 204.74.99.100
YEREL_IP Yerel ağdaki IP adresiniz 192.168.1.5
YEREL_AĞ Yerel ağınız 192.168.1.0/24
İKİNCİL_DNS Alan adınız için ikincil DNS sunucusunun IP adresi 209.177.148.228
ADMIN DNS sunucu yöneticisinin adı root
DÜZENLEME Rakam eklenmiş olarak alan dosyasının düzenlenme tarihi 2009062901

BIND'i Yapılandırma

Kurulum

Öncelikle net-dns/bind paketini kuralım.

root #emerge --ask net-dns/bind

/etc/bind/named.conf dosyasını düzenleme

İlk düzenleyeceğimiz dosya /etc/bind/named.conf. İlk yapacaklarımız bind'in kök dizinini, dinleyeceği IP ve portlarla, PID dosyasının yerini belirlemek ve IPv6 için bir satır eklemek.

Codeoptions bölümü

'"`UNIQ--pre-00000001-QINU`"'

This is a deprecated template. Help us update this template!

named.conf'un ikinci bölümü yerel ağ ile ilgili.

CodeYerel ayarları

'"`UNIQ--pre-00000004-QINU`"'

This is a deprecated template. Help us update this template!

named.conf'un sonraki bölümü de ağımızın dışından alan adımızı veya DNS sunucumuzu kullanarak diğer alan adlarını çözümlemek isteyenler için.

CodeDış ağ

'"`UNIQ--pre-00000007-QINU`"'

This is a deprecated template. Help us update this template!

En son bölüm de kayıtlar ile ilgili.

CodeKayıtlar

'"`UNIQ--pre-0000000A-QINU`"'

This is a deprecated template. Help us update this template!

/var/log/named/ dizini var olmalı ve named kullanıcısının sahipliğinde olmalı:

root #mkdir -p /var/log/named/
root #chmod 770 /var/log/named/
root #touch /var/log/named/named.log
root #chmod 660 /var/log/named/named.log
root #chown -R named /var/log/named/
root #chgrp -R named /var/log/named/

Dahili alan dosyasını oluşturmak

Ağımızın tanımını yapmak için host isimleri ve IP adreslerini kullanacağız. Nerdeyse tüm alan adlarının nokta ile bittiğine dikkat edin.

Code/var/bind/pri/ALAN_ADINIZ.internal

'"`UNIQ--pre-0000000D-QINU`"'

This is a deprecated template. Help us update this template!

Harici alan dosyasını oluşturmak

Burada da sadece dışarıdan erişen istemcilerin kullanacağı alt domainleri listeliyoruz (www, mail ve ns).

Code/var/bind/pri/ALAN_ADINIZ.external

'"`UNIQ--pre-00000010-QINU`"'

This is a deprecated template. Help us update this template!

Yapılandırmayı tamamlama

named servisini default çalışma seviyesine eklemelisiniz:

root #rc-update add named default

İstemcileri yapılandırma

Artık alan adlarını çözümlemek için DNS sunucunuzu kullanabilirsiniz. /etc/resolv.conf dosyasını düzenlediğniz bilgisayarlarda kullanılacaktır.

Code/etc/resolv.conf düzenlemesi

'"`UNIQ--pre-00000013-QINU`"'

This is a deprecated template. Help us update this template!

Note that YOUR_DNS_SERVER_IP is the same as YOUR_LOCAL_IP we used in this document. In the picture the example is 192.168.1.5.

Testing

We are able to test our new DNS server. First, we need to start the service.

root #/etc/init.d/named start

Now, we are going to make some host commands to some domains. We can use any computer of our local network to do this test. If you don't have net-dns/host installed you can use ping instead. Otherwise, first run emerge host .

user $host www.gentoo.org
www.gentoo.org has address 209.177.148.228
www.gentoo.org has address 209.177.148.229
user $host hell
hell.YOUR_DOMAIN has address 192.168.1.3
user $host router
router.YOUR_DOMAIN has address 192.168.1.1

Protecting the server with iptables

When running the DNS service, iptables can be configured with these rules for added protection:

CODE Iptables rules
iptables -A INPUT -p udp --sport 53 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -p tcp --dport 53 -j ACCEPT

This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Vicente Olivert Riera, nightmorph
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.