IGOS Nusantara dan DNS dengan BIND chroot: Perbedaan revisi
(→Berkas: /var/named/chroot/etc/named.conf) |
|||
Baris 3: | Baris 3: | ||
== Pasang == | == Pasang == | ||
yum install bind-chroot bind-utils caching-nameserver | yum install bind-chroot bind-utils caching-nameserver | ||
+ | |||
+ | Salin /etc/named.conf | ||
+ | # cp /etc/named.conf /var/named/chroot/etc/named.conf | ||
+ | |||
+ | Masuk sebagai root, lalu salin berkas: | ||
+ | cp /usr/share/doc/bind-9.8.0/sample/var/named/named.local /var/named/chroot/var/named/named.local | ||
+ | cp /usr/share/doc/bind-9.8.0/sample/var/named/named.localhost /var/named/chroot/var/named/named.localhost | ||
+ | cp /usr/share/doc/bind-9.8.0/sample/var/named/named.ca /var/named/chroot/var/named/named.ca | ||
+ | |||
+ | cp /usr/share/doc/bind-9.8.0/sample/var/named/named.empty /var/named/chroot/var/named/named.empty | ||
+ | cp /usr/share/doc/bind-9.8.0/sample/var/named/named.loopback /var/named/chroot/var/named/named.loopback | ||
+ | |||
+ | touch /var/named/chroot/etc/named.conf.local | ||
== Konfigurasi BIND == | == Konfigurasi BIND == | ||
Baris 35: | Baris 48: | ||
=== Berkas: /var/named/chroot/etc/named.conf === | === Berkas: /var/named/chroot/etc/named.conf === | ||
− | |||
− | |||
− | |||
* Tambahkan pada bagian bawah, mulai (sekitar) baris 45 | * Tambahkan pada bagian bawah, mulai (sekitar) baris 45 | ||
Baris 46: | Baris 56: | ||
zone "rumahku.com" IN { | zone "rumahku.com" IN { | ||
type master; | type master; | ||
− | file "db.rumahku.com"; | + | file "/var/named/db.rumahku.com"; |
allow-update { key "rndckey"; }; | allow-update { key "rndckey"; }; | ||
allow-transfer { 192.168.0/26; }; | allow-transfer { 192.168.0/26; }; | ||
Baris 54: | Baris 64: | ||
zone "0.168.192.in-addr.arpa" IN { | zone "0.168.192.in-addr.arpa" IN { | ||
type master; | type master; | ||
− | file "db.192"; | + | file "/var/named/db.192"; |
allow-update { key "rndckey"; }; | allow-update { key "rndckey"; }; | ||
allow-transfer { 192.168.0/26; }; | allow-transfer { 192.168.0/26; }; | ||
Baris 65: | Baris 75: | ||
$ttl 38400 | $ttl 38400 | ||
− | @ IN SOA | + | @ IN SOA rumahku.com. info.rumahku.com ( |
2011082801 ; serial: tahun-bulan-tgl-nomor | 2011082801 ; serial: tahun-bulan-tgl-nomor | ||
1H ; refresh | 1H ; refresh | ||
Baris 71: | Baris 81: | ||
1W ; kadaluarsa | 1W ; kadaluarsa | ||
1D) ; minimum | 1D) ; minimum | ||
− | IN | + | @ IN NS ns1.rumahku.com. |
− | IN | + | @ IN A 192.168.0.1 |
− | ns1 IN A | + | @ IN MX 10 mail.rumahku.com. |
− | www IN CNAME | + | ns1 IN A 192.168.0.1 |
− | ftp IN CNAME | + | www IN CNAME ns1 |
+ | ftp IN CNAME ns1 | ||
=== Berkas: /var/named/chroot/var/named/db.192 === | === Berkas: /var/named/chroot/var/named/db.192 === | ||
$ttl 38400 | $ttl 38400 | ||
− | @ IN SOA | + | @ IN SOA rumahku.com. info.rumahku.com ( |
2011082801 ; serial: tahun-bulan-tgl-nomor | 2011082801 ; serial: tahun-bulan-tgl-nomor | ||
1H ; refresh | 1H ; refresh | ||
Baris 86: | Baris 97: | ||
1W ; kadaluarsa | 1W ; kadaluarsa | ||
1D) ; minimum | 1D) ; minimum | ||
− | IN NS | + | @ IN NS ns1.rumahku.com. |
1 IN PTR ns1.rumahku.com. | 1 IN PTR ns1.rumahku.com. | ||
Baris 94: | Baris 105: | ||
zone "latihanku.com" IN { | zone "latihanku.com" IN { | ||
type master; | type master; | ||
− | file "db.latihanku.com"; | + | file "/var/names/db.latihanku.com"; |
allow-update { key "rndckey"; }; | allow-update { key "rndckey"; }; | ||
allow-transfer { 192.168.0/26; }; | allow-transfer { 192.168.0/26; }; | ||
Baris 102: | Baris 113: | ||
zone "percobaanku.com" IN { | zone "percobaanku.com" IN { | ||
type master; | type master; | ||
− | file "db.percobaanku.com"; | + | file "/var/named/db.percobaanku.com"; |
allow-update { key "rndckey"; }; | allow-update { key "rndckey"; }; | ||
allow-transfer { 192.168.0/26; }; | allow-transfer { 192.168.0/26; }; | ||
Baris 110: | Baris 121: | ||
$ttl 38400 | $ttl 38400 | ||
− | @ IN SOA | + | @ IN SOA rumahku.com. info.rumahku.com ( |
2011082801 ; serial: tahun-bulan-tgl-nomor | 2011082801 ; serial: tahun-bulan-tgl-nomor | ||
1H ; refresh | 1H ; refresh | ||
Baris 125: | Baris 136: | ||
$ttl 38400 | $ttl 38400 | ||
− | @ IN SOA | + | @ IN SOA rumahku.com. info.rumahku.com ( |
− | + | ||
2011082801 ; serial: tahun-bulan-tgl-nomor | 2011082801 ; serial: tahun-bulan-tgl-nomor | ||
1H ; refresh | 1H ; refresh | ||
Baris 148: | Baris 158: | ||
nameserver 127.0.0.1 | nameserver 127.0.0.1 | ||
nameserver 192.168.0.1 | nameserver 192.168.0.1 | ||
+ | |||
+ | === Sesuaikan hak akses === | ||
+ | Login sebagai root, lalu jalankan: | ||
+ | rm /etc/rndc.key | ||
+ | chown named:named /var/named/chroot/etc/bind/ | ||
+ | chmod 755 /var/named/chroot/etc/bind/ | ||
+ | |||
+ | chown named:named /var/named/chroot/etc/named.conf | ||
+ | chmod 600 /var/named/chroot/etc/named.conf | ||
+ | |||
+ | chown root:named /var/named/chroot/etc/rndc.conf | ||
+ | chmod 440 /var/named/chroot/etc/rndc.conf | ||
+ | |||
+ | chown named:named /var/named/chroot/etc/bind/bind.log | ||
+ | chmod 600 /var/named/chroot/etc/bind/bind.log | ||
+ | |||
+ | chown named:named /var/named/chroot/etc/bind/logging | ||
+ | chmod 400 /var/named/chroot/etc/bind/logging | ||
+ | |||
+ | cd /var/named/chroot/etc/bind/ | ||
+ | chown named:named * | ||
+ | |||
+ | chown named:root /var/named/chroot/etc/bind/named-stats.log | ||
+ | chmod 660 /var/named/chroot/etc/bind/named-stats.log | ||
+ | |||
+ | chown named:named root.hint db.* | ||
+ | chmod 400 db.* | ||
=== Periksa konfigurasi === | === Periksa konfigurasi === | ||
Baris 155: | Baris 192: | ||
Periksa konfigurasi zone | Periksa konfigurasi zone | ||
sintak # named-checkzone {zonename} {filename} | sintak # named-checkzone {zonename} {filename} | ||
− | |||
− | |||
# named-checkzone rumahku.com /var/named/chroot/var/named/db.rumahku.com | # named-checkzone rumahku.com /var/named/chroot/var/named/db.rumahku.com | ||
+ | # named-checkzone latihanku.com /var/named/chroot/var/named/db.latihanku.com | ||
+ | # named-checkzone percobaanku.com /var/named/chroot/var/named/db.percobaanku.com | ||
=== Jalankan BIND === | === Jalankan BIND === |
Revisi per 27 Agustus 2011 19.33
Lihat skema jaringan: http://igos-nusantara.or.id/wiki/Skema_Jaringan
Daftar isi
- 1 Pasang
- 2 Konfigurasi BIND
- 3 Matikan SELinux
- 4 Sesuaikan /etc/hosts
- 5 DNS server untuk rumahku.com
- 5.1 Berkas: /var/named/chroot/etc/named.conf
- 5.2 Berkas: /var/named/chroot/var/named/db.rumahku.com
- 5.3 Berkas: /var/named/chroot/var/named/db.192
- 5.4 Berkas: /var/named/chroot/etc/db.other.conf
- 5.5 Berkas: /var/named/chroot/var/named/db.latihanku.com
- 5.6 Berkas: /var/named/chroot/var/named/db.percobaanku.com
- 5.7 Salin berkas /etc/named.rfc1912.zones
- 5.8 Berkas: /etc/resolv.conf
- 5.9 Sesuaikan hak akses
- 5.10 Periksa konfigurasi
- 5.11 Jalankan BIND
- 6 Tes konfigurasi DNS server =
- 7 chkconfig
- 8 Jalankan
- 9 Konfigurasi client
Pasang
yum install bind-chroot bind-utils caching-nameserver
Salin /etc/named.conf
# cp /etc/named.conf /var/named/chroot/etc/named.conf
Masuk sebagai root, lalu salin berkas:
cp /usr/share/doc/bind-9.8.0/sample/var/named/named.local /var/named/chroot/var/named/named.local cp /usr/share/doc/bind-9.8.0/sample/var/named/named.localhost /var/named/chroot/var/named/named.localhost cp /usr/share/doc/bind-9.8.0/sample/var/named/named.ca /var/named/chroot/var/named/named.ca cp /usr/share/doc/bind-9.8.0/sample/var/named/named.empty /var/named/chroot/var/named/named.empty cp /usr/share/doc/bind-9.8.0/sample/var/named/named.loopback /var/named/chroot/var/named/named.loopback touch /var/named/chroot/etc/named.conf.local
Konfigurasi BIND
File-file yang harus diperhatikan untuk mengkonfigurasikan BIND, antara lain:
- /etc/resolv.conf -> berisi alamat domain atau alamat IP dari name server.
- /etc/named.conf -> berisi keterangan letak dan jenis database yang dibutuhkan oleh BIND.
- /var/named/named.ca -> berisi informasi data yang berada dalam domain root, yang akan dipergunakan name server jika ada resolver yang akan meminta nama domain diluar nama domain lokal.
- /var/named/named.local -> berisi alamat loopback untuk alamat ke diri sendiri dengan alamat 127.0.0.1.
Matikan SELinux
Ikuti petunjuk: http://igos-nusantara.or.id/wiki/IGOS_Nusantara_dan_SELinux
Sesuaikan /etc/hosts
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost 192.168.0.1 ns1.rumahku.com ns1 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
DNS server untuk rumahku.com
Dalam studi kasus kali ini akan membuat domain baru untuk DNS Server dan mail server, ftp server, http server, dengan data sebagai berikut:
- IP DNS Server: 192.168.0.1
- Nama DNS Server: ns1.rumahku.com
- Domain: rumahku.com
- Nama Mail Server: mail.rumahku.com di IP 192.168.0.1
- Nama HTTP Server: www.rumahku.com di IP 192.168.0.1
- Nama FTP Server: ftp.rumahku.com di IP 192.168.0.1
- Domain lain:
- Nama Domain2: latihanku.com di IP 192.168.0.20
- Nama Domain3: percobaanku.com di IP 192.168.0.30
Berkas: /var/named/chroot/etc/named.conf
- Tambahkan pada bagian bawah, mulai (sekitar) baris 45
// ... baris yg sudah ada ... // Tambahan: // Konfigurasi resolve DNS zone "rumahku.com" IN { type master; file "/var/named/db.rumahku.com"; allow-update { key "rndckey"; }; allow-transfer { 192.168.0/26; }; }; // Konfigurasi reverse DNS zone "0.168.192.in-addr.arpa" IN { type master; file "/var/named/db.192"; allow-update { key "rndckey"; }; allow-transfer { 192.168.0/26; }; }; include "/etc/db.other.conf";
Berkas: /var/named/chroot/var/named/db.rumahku.com
Buat berkas baru /var/named/chroot/var/named/db.rumahku.com
$ttl 38400 @ IN SOA rumahku.com. info.rumahku.com ( 2011082801 ; serial: tahun-bulan-tgl-nomor 1H ; refresh 1M ; retry 1W ; kadaluarsa 1D) ; minimum @ IN NS ns1.rumahku.com. @ IN A 192.168.0.1 @ IN MX 10 mail.rumahku.com. ns1 IN A 192.168.0.1 www IN CNAME ns1 ftp IN CNAME ns1
Berkas: /var/named/chroot/var/named/db.192
$ttl 38400 @ IN SOA rumahku.com. info.rumahku.com ( 2011082801 ; serial: tahun-bulan-tgl-nomor 1H ; refresh 1M ; retry 1W ; kadaluarsa 1D) ; minimum @ IN NS ns1.rumahku.com. 1 IN PTR ns1.rumahku.com.
Berkas: /var/named/chroot/etc/db.other.conf
// Konfigurasi domain latihanku.com zone "latihanku.com" IN { type master; file "/var/names/db.latihanku.com"; allow-update { key "rndckey"; }; allow-transfer { 192.168.0/26; }; }; // Konfigurasi domain percobaanku.com zone "percobaanku.com" IN { type master; file "/var/named/db.percobaanku.com"; allow-update { key "rndckey"; }; allow-transfer { 192.168.0/26; }; };
Berkas: /var/named/chroot/var/named/db.latihanku.com
$ttl 38400 @ IN SOA rumahku.com. info.rumahku.com ( 2011082801 ; serial: tahun-bulan-tgl-nomor 1H ; refresh 1M ; retry 1W ; kadaluarsa 1D) ; minimum IN NS ns1.latihanku.com. IN MX 20 mail.latihanku.com. ns1 IN A 192.168.0.20 www IN CNAME ns1 ftp IN CNAME ns1
Berkas: /var/named/chroot/var/named/db.percobaanku.com
$ttl 38400 @ IN SOA rumahku.com. info.rumahku.com ( 2011082801 ; serial: tahun-bulan-tgl-nomor 1H ; refresh 1M ; retry 1W ; kadaluarsa 1D) ; minimum IN NS ns1.percobaanku.com. IN MX 20 mail.percobaanku.com. ns1 IN A 192.168.0.30 www IN CNAME ns1 ftp IN CNAME ns1
Salin berkas /etc/named.rfc1912.zones
# cp /etc/named.rfc1912.zones /var/named/chroot/etc/
Berkas: /etc/resolv.conf
Berkas /etc/resolv.conf di komputer server 192.168.0.1 diisi:
search rumahku.com search latihanku.com search percobaanku.com nameserver 127.0.0.1 nameserver 192.168.0.1
Sesuaikan hak akses
Login sebagai root, lalu jalankan:
rm /etc/rndc.key chown named:named /var/named/chroot/etc/bind/ chmod 755 /var/named/chroot/etc/bind/
chown named:named /var/named/chroot/etc/named.conf chmod 600 /var/named/chroot/etc/named.conf
chown root:named /var/named/chroot/etc/rndc.conf chmod 440 /var/named/chroot/etc/rndc.conf
chown named:named /var/named/chroot/etc/bind/bind.log chmod 600 /var/named/chroot/etc/bind/bind.log
chown named:named /var/named/chroot/etc/bind/logging chmod 400 /var/named/chroot/etc/bind/logging
cd /var/named/chroot/etc/bind/ chown named:named *
chown named:root /var/named/chroot/etc/bind/named-stats.log chmod 660 /var/named/chroot/etc/bind/named-stats.log
chown named:named root.hint db.* chmod 400 db.*
Periksa konfigurasi
Pastikan konfigurasi BIND yang telah dibuat tidak ada kesalahan. Lakukan pemeriksaan dengan cara:
# named-checkconf -t /var/named/chroot /etc/named.conf
Periksa konfigurasi zone sintak # named-checkzone {zonename} {filename}
# named-checkzone rumahku.com /var/named/chroot/var/named/db.rumahku.com # named-checkzone latihanku.com /var/named/chroot/var/named/db.latihanku.com # named-checkzone percobaanku.com /var/named/chroot/var/named/db.percobaanku.com
Jalankan BIND
Jika pemeriksaan konfigurasi sudah benar, buka dua terminal:
Terminal1:
# tail -f /var/log/messages
Terminal2:
# service named start
Periksa tampilan di Terminal1, ada kemungkinan konfigurasi perlu diperbaiki.
Tes konfigurasi DNS server =
$ dig rumahku.com $ nslookup www.rumahku.com
Jalankan daemon DNS server
Pasang untuk runlevel yang diinginkan:
# /sbin/chkconfig --levels 235 named on
chkconfig
Masukkan DNS agar jalan di init 2, 3 dan 5 gunakan:
# chkconfig --levels 235 named on
Jalankan
# service named start
Konfigurasi client
Pengakses atau client (misal) ada di PC5. Atur agar PC5 memakai DNS server yang ada di 192.168.0.1.