REFERENSI LENGKAP DNS RECORD UNTUK MURID TKJ
nslookup, dig, atau host di terminal.| TYPE | CODE | FUNGSI | CONTOH |
|---|---|---|---|
| A | 1 | IPv4 address | example.com -> 93.184.216.34 |
| AAAA | 28 | IPv6 address | example.com -> 2606:2800:220:1:... |
| CNAME | 5 | Alias ke domain lain | www -> example.com |
| MX | 15 | Mail server | example.com -> 10 mail.example.com |
| TXT | 16 | Teks arbitrary | SPF, DKIM, verifikasi domain |
| NS | 2 | Name server | example.com -> ns1.host.com |
| PTR | 12 | Reverse DNS | 34.216.184.93.in-addr -> example.com |
| SOA | 6 | Start of Authority | Info zona: primary NS, email admin |
| SRV | 33 | Service locator | _sip._tcp.example.com |
| CAA | 257 | Certificate Authority | issue "letsencrypt.org" |
| DNSKEY | 48 | DNSSEC public key | Untuk validasi DNSSEC |
| DS | 43 | Delegation Signer | Link ke DNSKEY child zone |
| TLSA | 52 | DANE certificate | Untuk DANE validation |
| LOC | 29 | Geographic location | Latitude/longitude/altitude |
| HINFO | 13 | Host information | CPU dan OS (jarang dipakai) |
| USE CASE | TTL | ALASAN |
|---|---|---|
| Production A/AAAA record | 3600 (1 jam) | Balance performa & agility |
| Sebelum maintenance | 300 (5 menit) | Perubahan cepat tersebar |
| Stable record (tidak berubah) | 86400 (24 jam) | Minimalkan load DNS server |
| MX record | 3600 (1 jam) | Balance untuk mail routing |
| NS record | 86400 (24 jam) | Jarang berubah |
| SPF/DKIM/DMARC | 3600-86400 | Email policy stabil |
| Domain verification TXT | 300 (5 menit) | Verifikasi cepat, hapus setelahnya |
| Load balancer / CDN | 60-300 | Fast failover |
| COMMAND | OS | FUNGSI | CONTOH |
|---|---|---|---|
| nslookup | Windows/Linux/Mac | Query DNS basic | nslookup example.com |
| dig | Linux/Mac | Query DNS advanced | dig example.com MX |
| host | Linux/Mac | Query DNS simple | host -t MX example.com |
| ping | Semua | Test connectivity | ping example.com |
| ipconfig /flushdns | Windows | Flush DNS cache | ipconfig /flushdns |
| systemd-resolve --flush-caches | Linux | Flush DNS cache | sudo systemd-resolve --flush-caches |
| dscacheutil -flushcache | macOS | Flush DNS cache | sudo dscacheutil -flushcache |
| whois | Linux/Mac | Query domain registration | whois example.com |
| PROVIDER | PRIMARY | SECONDARY | FEATURES |
|---|---|---|---|
| 8.8.8.8 | 8.8.4.4 | Cepat, reliable | |
| Cloudflare | 1.1.1.1 | 1.0.0.1 | Privasi, tercepat |
| Quad9 | 9.9.9.9 | 149.112.112.112 | Security, block malware |
| OpenDNS | 208.67.222.222 | 208.67.220.220 | Filtering, parental control |
| AdGuard | 94.140.14.14 | 94.140.15.15 | Block ads & trackers |
| ControlD | 76.76.2.0 | 76.76.10.0 | Customizable filtering |
DNS (Domain Name System) adalah sistem hierarkis yang menerjemahkan nama domain (contoh: www.google.com) menjadi IP address (contoh: 142.250.195.4). Diibaratkan seperti buku telepon internet.
Manusia : www.google.com (mudah diingat) Komputer : 142.250.195.4 (mesin pakai ini) DNS : penerjemah keduanya
Kenapa DNS penting?
DNS berbentuk tree (pohon) terbalik, dari root sampai leaf:
. (Root)
/|\
/ | \
com id org <- TLD (Top Level Domain)
/ |
google my.id <- SLD (Second Level Domain)
|
www <- Subdomain
Contoh breakdown: www.mail.abdurrozak.my.id
. = Root (tidak terlihat, tapi ada)id = TLD (country-code TLD untuk Indonesia)my.id = SLD (domain yang diregistrasi)abdurrozak.my.id = domain lengkapmail.abdurrozak.my.id = subdomain level 1www.mail.abdurrozak.my.id = subdomain level 2Contoh: user buka www.abdurrozak.my.id
1. Browser cek cache lokal (browser cache) 2. Jika tidak ada, OS cek cache (OS cache, hosts file) 3. Jika tidak ada, query ke recursive resolver (ISP DNS) 4. Recursive resolver cek cache-nya 5. Jika tidak ada: a. Query ke Root Server: "Di mana server .my.id?" b. Root jawab: "Query ke .my.id TLD server (123.45.67.89)" c. Query ke .my.id TLD: "Di mana server abdurrozak.my.id?" d. TLD jawab: "Query ke ns1.host.com (103.123.45.67)" e. Query ke ns1.host.com: "Apa IP www.abdurrozak.my.id?" f. Authoritative jawab: "103.123.45.68" 6. Recursive resolver cache jawaban (sesuai TTL) 7. Kembalikan IP ke browser 8. Browser konek ke 103.123.45.68
Waktu total: biasanya 20-100 ms jika tidak di-cache. Jika di-cache, instant!
Memetakan domain ke IPv4 address. Paling dasar dan sering dipakai.
example.com. 3600 IN A 93.184.216.34
Memetakan domain ke IPv6 address. Versi modern dari A record.
example.com. 3600 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
Alias dari satu domain ke domain lain. Tidak bisa di-apex (root domain).
www.example.com. 3600 IN CNAME example.com.
Menentukan mail server untuk domain. Ada priority (lower = higher priority).
example.com. 3600 IN MX 10 mail.example.com. example.com. 3600 IN MX 20 mail2.example.com.
Menyimpan teks arbitrary. Dipakai untuk SPF, DKIM, DMARC, verifikasi domain.
example.com. 3600 IN TXT "v=spf1 include:_spf.google.com ~all"
Menentukan authoritative name server untuk domain.
example.com. 86400 IN NS ns1.hosting.com. example.com. 86400 IN NS ns2.hosting.com.
Reverse DNS - memetakan IP kembali ke domain. Untuk email authentication.
34.216.184.93.in-addr.arpa. 3600 IN PTR example.com.
Info otoritatif tentang zona DNS: primary NS, email admin, serial, timers.
example.com. 3600 IN SOA ns1.hosting.com. admin.example.com. (
2024010101 ; serial
3600 ; refresh (1 jam)
900 ; retry (15 menit)
604800 ; expire (1 minggu)
86400 ; minimum TTL (1 hari)
)
TTL = berapa lama (dalam detik) DNS record boleh di-cache oleh resolver.
TTL 3600 = 1 jam -> record di-cache 1 jam TTL 86400 = 24 jam -> record di-cache 1 hari TTL 300 = 5 menit -> record di-cache 5 menit
Trade-off:
Best practice: TTL 3600 (1 jam) untuk production, turunkan ke 300 sebelum maintenance, naikkan lagi setelah stabil.
TXT record yang menentukan IP/server mana yang boleh kirim email untuk domain.
"v=spf1 include:_spf.google.com include:mail.zendesk.com ip4:103.123.45.67 ~all" v=spf1 -> versi SPF include: -> domain lain yang boleh kirim ip4: -> IP spesifik yang boleh kirim ~all -> softfail (tolak tapi jangan reject keras) -all -> hardfail (reject semua yang tidak listed)
TXT record berisi public key untuk verifikasi tanda tangan digital email.
selector._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSq..."
Policy yang menentukan apa yang dilakukan jika email gagal SPF/DKIM.
_dmarc.example.com. IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc@example.com; pct=100" v=DMARC1 -> versi DMARC p= -> policy (none, quarantine, reject) rua= -> email untuk laporan aggregate ruf= -> email untuk laporan forensic pct= -> persentase email yang di-enforce
File teks yang menyimpan semua DNS record untuk sebuah domain. Format BIND:
$TTL 86400
@ IN SOA ns1.hosting.com. admin.example.com. (
2024010101 ; Serial (YYYYMMDDNN)
3600 ; Refresh
900 ; Retry
604800 ; Expire
86400 ; Minimum TTL
)
; Name Server Records
@ IN NS ns1.hosting.com.
@ IN NS ns2.hosting.com.
; A Records
@ IN A 93.184.216.34
www IN A 93.184.216.34
mail IN A 93.184.216.35
; MX Records
@ IN MX 10 mail.example.com.
@ IN MX 20 mail2.example.com.
; TXT Records
@ IN TXT "v=spf1 include:_spf.google.com ~all"
Konvensi penting:
@ = apex/root domain (example.com)IN = class Internet (selalu dipakai)nslookup example.com nslookup -type=MX example.com nslookup example.com 8.8.8.8
dig example.com dig example.com MX dig +trace example.com ; lihat full resolution path dig @8.8.8.8 example.com ; query ke specific DNS dig +short example.com ; output singkat dig +noall +answer example.com ; hanya jawaban
host example.com host -t MX example.com host -t NS example.com
Windows: ipconfig /flushdns Linux: sudo systemd-resolve --flush-caches macOS: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Sebelum migrasi server atau perubahan IP, turunkan TTL ke 300 (5 menit) minimal 24 jam sebelumnya. Setelah perubahan stabil, naikkan kembali ke 3600 atau lebih. Ini memastikan perubahan tersebar cepat.
Untuk domain yang kirim email, WAJIB setup 3 record ini. Tanpa ini, email akan masuk spam atau ditolak. SPF = siapa yang boleh kirim, DKIM = tanda tangan digital, DMARC = policy penanganan.
Selalu punya minimal 2 authoritative name server di provider berbeda. Jika 1 down, yang lain masih bisa layani query. Ini requirement standar untuk domain registration.
Banyak mail server (Gmail, Yahoo) menolak email jika IP tidak punya PTR record yang match dengan HELO hostname. Setup PTR di sisi ISP/hosting, bukan di DNS domain.
CNAME di root domain (example.com) melanggar RFC dan bisa menyebabkan masalah dengan MX, TXT record. Pakai ALIAS/ANAME record (provider-specific) atau A record langsung.
DNSSEC mencegah DNS spoofing dengan menambahkan tanda tangan digital. Banyak registrar dan DNS provider sudah support. Aktifkan di panel domain, setup DS record di registrar.
DNS query tradisional tidak terenkripsi - ISP bisa lihat semua domain yang Anda kunjungi. Pakai DNS over HTTPS (DoH) atau DNS over TLS (DoT) untuk privasi. Browser modern sudah support.
Format serial: YYYYMMDDNN (tahun, bulan, tanggal, nomor urut). Contoh: 2024010101 = 1 Januari 2024, update ke-1. Setiap kali edit zone file, serial HARUS naik. Jika tidak, secondary NS tidak akan sync.
Sebelum ganti NS atau IP production, test di staging dulu. Pakai dig @ns1.newhost.com domain.com untuk query langsung ke authoritative server baru. Pastikan semua record benar sebelum switch.
Gunakan tools: DNS Checker (dnschecker.org), IntoDNS (intodns.com), MX Toolbox (mxtoolbox.com), Google DNS Check. Monitor propagasi, cek konfigurasi, deteksi masalah.
Wildcard (*.example.com) catch-all untuk semua subdomain yang tidak ada. Berguna untuk catch-all, tapi bisa menyebabkan konflik dengan record spesifik. Test dengan hati-hati.
Zone file adalah konfigurasi kritis. Backup sebelum edit, simpan di version control (git). Jika ada masalah, rollback cepat. Dokumentasi setiap perubahan dengan comment di zone file.
Untuk kantor/sekolah, setup internal DNS server (BIND, Windows DNS, dnsmasq). Benefit: cache lokal (cepat), kontrol penuh, bisa buat internal domain (server.local, printer.local).
Attacker bisa inject fake DNS response. Cegah dengan: pakai DNSSEC, update DNS server software, pakai random source port, batasi recursion ke trusted clients saja, monitor anomali.
DNS propagation bisa memakan waktu 15 menit sampai 72 jam, tergantung:
Tips: Turunkan TTL 24 jam sebelum perubahan besar. Gunakan DNS checker online untuk monitor propagasi di berbagai lokasi.
Rule: Pakai A record untuk IP, CNAME untuk alias ke domain lain. Jangan pakai CNAME di root domain!
Penyebab umum:
ipconfig /flushdns (Windows)Diagnosa:
1. Cek di multiple DNS checker online 2. Query langsung ke authoritative: dig @ns1.host.com domain.com 3. Cek di Google DNS: dig @8.8.8.8 domain.com 4. Bandingkan dengan ISP DNS: dig @ISP_DNS domain.com 5. Jika beda = masalah propagasi/cache
MX (Mail Exchange) record menentukan server mana yang menerima email untuk domain.
Format:
example.com. 3600 IN MX 10 mail.example.com. example.com. 3600 IN MX 20 mail2.example.com. 10, 20 = priority (lower = higher priority) mail.example.com = hostname mail server
Setup untuk Google Workspace:
example.com. IN MX 1 aspmx.l.google.com. example.com. IN MX 5 alt1.aspmx.l.google.com. example.com. IN MX 5 alt2.aspmx.l.google.com. example.com. IN MX 10 alt3.aspmx.l.google.com. example.com. IN MX 10 alt4.aspmx.l.google.com.
Wajib juga: setup SPF, DKIM, DMARC untuk mencegah email masuk spam!
Tiga TXT record untuk email authentication:
Daftar IP/server yang BOLEH kirim email untuk domain.
"v=spf1 include:_spf.google.com ip4:103.123.45.67 ~all"
Tanda tangan digital untuk verifikasi keaslian email.
selector._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0..."
Policy: apa yang dilakukan jika email gagal SPF/DKIM.
_dmarc IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"
Kenapa penting? Tanpa ini, email Anda akan masuk spam atau ditolak oleh Gmail, Yahoo, Outlook. Semua provider besar WAJIBkan ini sekarang.
Command untuk flush DNS cache di berbagai OS:
ipconfig /flushdns # Output: "Successfully flushed the DNS Resolver Cache"
sudo systemd-resolve --flush-caches # atau sudo resolvectl flush-caches
sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder
Tips: Flush di semua level: browser, OS, router (jika router punya DNS cache).
Wildcard record menggunakan asterisk (*) untuk match semua subdomain yang tidak punya record spesifik.
*.example.com. IN A 93.184.216.34 # Ini berarti: # abc.example.com -> 93.184.216.34 # xyz.example.com -> 93.184.216.34 # apapun.example.com -> 93.184.216.34
Use case:
Peringatan:
Command line tools:
# Lihat semua record dig example.com ANY # Record spesifik dig example.com A dig example.com MX dig example.com TXT dig example.com NS # Query ke DNS server tertentu dig @8.8.8.8 example.com # Lihat full resolution path dig +trace example.com # Output singkat dig +short example.com # Tools Windows nslookup example.com nslookup -type=MX example.com
Online tools:
DNS propagation = proses penyebaran perubahan DNS ke semua resolver di seluruh dunia.
Kenapa lama?
Cara percepat:
Contoh: Browser pakai recursive ke ISP DNS. ISP DNS pakai iterative ke Root, TLD, Authoritative.
Untuk belajar atau internal network, bisa setup DNS server sendiri:
# Install
sudo apt install bind9
# Edit config
sudo nano /etc/bind/named.conf.local
# Tambah zone:
# zone "example.local" {
# type master;
# file "/etc/bind/db.example.local";
# };
# Buat zone file
sudo nano /etc/bind/db.example.local
# Copy dari db.local, edit sesuai kebutuhan
# Test config
named-checkconf
named-checkzone example.local /etc/bind/db.example.local
# Restart
sudo systemctl restart bind9Use case: Internal domain (server.local, printer.local), lab environment, belajar DNS.
DNSSEC (DNS Security Extensions) menambahkan tanda tangan digital ke DNS record untuk mencegah spoofing/poisoning.
Cara kerja:
Record tambahan:
Perlu tidak?
Langkah-langkah aman:
dig @ns1.newprovider.com domain.comWaktu downtime: biasanya 0-4 jam jika TTL sudah diturunkan sebelumnya.
BELUM ADA RIWAYAT