Konfigurasi IP Alias dan DNS
Konfigurasi IP Alias dan DNS Server
Modul ini membahas konfigurasi IP Alias pada interface jaringan dan instalasi DNS Server menggunakan BIND9 untuk mendukung share hosting dengan multiple domain.
Tujuan Pembelajaran
Setelah mempelajari modul ini, peserta didik mampu:
- Memahami konsep IP Alias
- Mengkonfigurasi IP Alias pada Debian
- Menginstal dan mengkonfigurasi BIND9
- Membuat zona DNS untuk multiple domain
- Menguji hasil konfigurasi DNS
Bagian 1: IP Alias
Konsep IP Alias
IP Alias adalah teknik untuk mengisi beberapa IP Address yang berbeda-beda pada satu interface ethernet/network adapter.
┌─────────────────────────────────────┐
│ SERVER │
│ │
│ ┌─────────────────────────────┐ │
│ │ Interface: ens33 │ │
│ │ │ │
│ │ ens33 : 192.168.56.20 │ │
│ │ ens33:1 : 192.168.56.22 │ │
│ │ ens33:2 : 192.168.56.23 │ │
│ │ ens33:3 : 192.168.56.24 │ │
│ │ │ │
│ └─────────────────────────────┘ │
└─────────────────────────────────────┘
Langkah Konfigurasi IP Alias
Langkah 1: Cek IP Address saat ini
# Menggunakan ip command ip a # Atau menggunakan ifconfig ifconfig
Langkah 2: Edit file konfigurasi interfaces
nano /etc/network/interfaces
Langkah 3: Tambahkan konfigurasi IP Alias
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto ens33
iface ens33 inet static
address 192.168.56.20
netmask 255.255.255.0
gateway 192.168.56.1
# IP Alias 1 - untuk domain cobabelajar.net
auto ens33:1
iface ens33:1 inet static
address 192.168.56.22
netmask 255.255.255.0
# IP Alias 2 - untuk domain latihan-server.com
auto ens33:2
iface ens33:2 inet static
address 192.168.56.23
netmask 255.255.255.0
Langkah 4: Restart networking
# Restart service networking systemctl restart networking # Atau /etc/init.d/networking restart
Langkah 5: Verifikasi IP Address
# Cek semua IP ip a # Hasil yang diharapkan: # ens33: 192.168.56.20/24 # ens33:1: 192.168.56.22/24 # ens33:2: 192.168.56.23/24
Bagian 2: DNS Server (BIND9)
Pengenalan DNS
DNS (Domain Name System) adalah sistem yang mengonversi nama domain menjadi IP address.
| Tanpa DNS | Dengan DNS |
|---|---|
| Akses: http://192.168.56.20 | Akses: http://panelku.com |
| Sulit diingat | Mudah diingat |
Instalasi BIND9
# Update repository apt update # Install BIND9 dan tools apt install bind9 bind9utils dnsutils -y # Verifikasi instalasi systemctl status bind9
Konfigurasi DNS Zone
Langkah 1: Masuk ke direktori bind
cd /etc/bind ls -la
Langkah 2: Buat file zona untuk domain
# Salin template db.local cp db.local db.panelku cp db.local db.belajar cp db.local db.latihan
Langkah 3: Edit file db.panelku
nano db.panelku
;
; BIND data file for panelku.com
;
$TTL 604800
@ IN SOA panelku.com. admin.panelku.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS panelku.com.
@ IN A 192.168.56.20
www IN A 192.168.56.20
Langkah 4: Edit file db.belajar
nano db.belajar
;
; BIND data file for cobabelajar.net
;
$TTL 604800
@ IN SOA cobabelajar.net. admin.cobabelajar.net. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS cobabelajar.net.
@ IN A 192.168.56.22
www IN A 192.168.56.22
Langkah 5: Edit file db.latihan
nano db.latihan
;
; BIND data file for latihan-server.com
;
$TTL 604800
@ IN SOA latihan-server.com. admin.latihan-server.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS latihan-server.com.
@ IN A 192.168.56.23
www IN A 192.168.56.23
Langkah 6: Edit named.conf.local
nano /etc/bind/named.conf.local
//
// Do any local configuration here
//
// Zone panelku.com
zone "panelku.com" {
type master;
file "/etc/bind/db.panelku";
};
// Zone cobabelajar.net
zone "cobabelajar.net" {
type master;
file "/etc/bind/db.belajar";
};
// Zone latihan-server.com
zone "latihan-server.com" {
type master;
file "/etc/bind/db.latihan";
};
Langkah 7: Edit named.conf.options
nano /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
// Izinkan query dari semua client
allow-query { any; };
// Forwarders ke DNS publik
forwarders {
8.8.8.8;
8.8.4.4;
};
// Nonaktifkan DNSSEC untuk testing
dnssec-validation no;
listen-on-v6 { any; };
};
Langkah 8: Konfigurasi resolv.conf
nano /etc/resolv.conf
nameserver 192.168.56.20 nameserver 8.8.8.8
Langkah 9: Restart BIND9
# Cek konfigurasi named-checkconf # Cek zona named-checkzone panelku.com /etc/bind/db.panelku named-checkzone cobabelajar.net /etc/bind/db.belajar named-checkzone latihan-server.com /etc/bind/db.latihan # Restart BIND9 systemctl restart bind9 # Cek status systemctl status bind9
Pengujian DNS
Menggunakan ping
ping panelku.com ping cobabelajar.net ping latihan-server.com
Hasil yang diharapkan: Reply dari IP masing-masing domain
Menggunakan nslookup
nslookup panelku.com nslookup cobabelajar.net nslookup latihan-server.com
Menggunakan dig
dig panelku.com dig cobabelajar.net A dig latihan-server.com +short
Konfigurasi DNS Client (Windows)
Untuk menggunakan DNS server yang telah dibuat:
- Buka Network and Sharing Center
- Klik Change adapter settings
- Klik kanan pada adapter → Properties
- Pilih Internet Protocol Version 4 (TCP/IPv4) → Properties
- Pilih Use the following DNS server addresses
- Masukkan: 192.168.56.20
- Klik OK
Troubleshooting DNS
| Masalah | Solusi |
|---|---|
| DNS tidak resolve | Cek status bind9: systemctl status bind9 |
| Zone file error | Jalankan: named-checkzone domain.com /etc/bind/db.file |
| Permission denied | Cek ownership file zona: chown bind:bind /etc/bind/db.* |
| Client tidak bisa resolve | Pastikan DNS client mengarah ke server DNS |
Aktivitas Praktik
Tugas: Buat DNS untuk 3 Domain Baru
| Domain | IP Address | Subdomain |
|---|---|---|
| smk.sch.id | 192.168.56.30 | www, mail, ftp |
| praktek.id | 192.168.56.31 | www, api |
| belajar.id | 192.168.56.32 | www, cdn |
Langkah:
- Konfigurasi IP Alias
- Buat file zona untuk setiap domain
- Tambahkan zone di named.conf.local
- Restart BIND9
- Uji dengan nslookup
Rangkuman
Referensi Sub Halaman
- Sebelumnya: ← Share Hosting Server
- Selanjutnya: Instalasi Ajenti →