DNS Server: ติดตั้ง BIND9 สำหรับ Internal DNS ขององค์กร

DNS Server: ติดตั้ง BIND9 สำหรับ Internal DNS ขององค์กร

DNS (Domain Name System) แปลงชื่อ domain เป็น IP address เป็นระบบพื้นฐานที่ทำให้ network ทำงานได้ องค์กรส่วนใหญ่ใช้ DNS ของ ISP หรือ public DNS (Google 8.8.8.8, Cloudflare 1.1.1.1) แต่การมี internal DNS server ให้ประโยชน์หลายอย่าง เช่น resolve internal hostnames, จัดการ DNS records ขององค์กรเอง, เพิ่ม privacy และ performance

BIND9 (Berkeley Internet Name Domain) เป็น DNS server software ที่นิยมที่สุดในโลก ใช้ใน internet root servers หลายตัว open-source ฟรี ทำงานบน Linux บทความนี้จะสอนวิธีติดตั้งและ configure BIND9 สำหรับ internal DNS ขององค์กร

ทำไมต้องมี Internal DNS

ข้อดี คำอธิบาย
Internal Name Resolution ใช้ชื่อแทน IP (เช่น printer.office.local แทน 192.168.1.50)
Split-horizon DNS Internal users เห็น internal IP, external users เห็น public IP
DNS Caching Cache DNS queries ลด latency และ bandwidth ไป external DNS
DNS Filtering Block malicious domains, ad domains ที่ระดับ DNS
Privacy DNS queries ไม่ถูกส่งไป public DNS (ISP ไม่เห็น)
Reliability Internal DNS ยังทำงานได้แม้ internet ขัดข้อง

ติดตั้ง BIND9 บน Ubuntu

Installation

ติดตั้ง BIND9 ด้วย apt install bind9 bind9utils bind9-doc ไฟล์ configuration หลักอยู่ที่ /etc/bind/ named.conf เป็น main config file named.conf.options ตั้งค่า options (forwarders, recursion, etc.) named.conf.local ตั้งค่า zones ขององค์กร

Configure Options

ตั้งค่า named.conf.options กำหนด listen-on ให้ listen บน IP ของ server กำหนด allow-query ให้เฉพาะ internal networks query ได้ กำหนด forwarders ให้ forward queries ที่ไม่รู้ไป public DNS (8.8.8.8, 1.1.1.1) เปิด recursion สำหรับ internal clients กำหนด dnssec-validation auto สำหรับ DNSSEC

สร้าง Forward Zone

Zone File

สร้าง forward zone สำหรับ domain ขององค์กร (เช่น company.local) ใน named.conf.local กำหนด zone “company.local” type master file “/etc/bind/zones/db.company.local” สร้าง zone file ด้วย SOA record, NS records, A records สำหรับ servers และ services ตัวอย่าง A records: dc01.company.local → 192.168.1.10, mail.company.local → 192.168.1.20, printer.company.local → 192.168.1.50

สร้าง Reverse Zone

PTR Records

Reverse zone แปลง IP address กลับเป็น hostname (reverse lookup) จำเป็นสำหรับ services หลายตัว (email servers ใช้ reverse DNS verify sender) สร้าง zone “1.168.192.in-addr.arpa” สำหรับ subnet 192.168.1.0/24 สร้าง PTR records: 10 → dc01.company.local, 20 → mail.company.local

DNS Record Types

Record Type หน้าที่ ตัวอย่าง
A Map hostname → IPv4 address server1.company.local → 192.168.1.10
AAAA Map hostname → IPv6 address server1.company.local → 2001:db8::10
CNAME Alias ชื่อหนึ่งไปอีกชื่อ www.company.local → webserver.company.local
MX Mail server สำหรับ domain company.local MX 10 mail.company.local
PTR Reverse lookup (IP → hostname) 192.168.1.10 → server1.company.local
NS DNS server สำหรับ zone company.local NS ns1.company.local
SOA Start of Authority (zone metadata) Serial number, refresh, retry, expire
SRV Service location _ldap._tcp.company.local → dc01:389
TXT Text record (SPF, DKIM, etc.) company.local TXT “v=spf1 …”

Secondary DNS (Slave)

High Availability

มี DNS server เครื่องเดียวไม่พอ ถ้าล่มทุกอย่างหยุด ตั้ง secondary DNS server (slave) ที่รับ zone transfer จาก primary (master) อัตโนมัติ configure บน primary: allow-transfer ให้ IP ของ secondary configure บน secondary: zone type slave, masters { primary_IP } เมื่อ primary update records secondary จะ sync อัตโนมัติ (zone transfer via AXFR/IXFR)

DNS Security

Restrict Recursion

อย่าเปิด recursion ให้ทุกคน ถ้า DNS server เปิด recursion ให้ internet จะถูกใช้เป็น open resolver สำหรับ DNS amplification attacks กำหนด allow-recursion เฉพาะ internal networks เท่านั้น

DNSSEC

DNSSEC ป้องกัน DNS spoofing/poisoning โดยการ sign DNS records ด้วย digital signatures clients verify signatures เพื่อยืนยันว่า DNS response มาจาก authoritative server จริง เปิด dnssec-validation auto ใน BIND9 options

Rate Limiting

ใช้ rate-limit ใน BIND9 จำกัดจำนวน responses ต่อวินาทีต่อ client ป้องกัน DNS amplification attack และ abuse

ทดสอบ DNS

เครื่องมือ

ใช้ dig ทดสอบ DNS queries: dig @dns_server_ip server1.company.local ใช้ nslookup สำหรับ quick test ใช้ named-checkconf ตรวจสอบ syntax ของ config files ใช้ named-checkzone ตรวจสอบ syntax ของ zone files ใช้ rndc status ดูสถานะของ BIND9 service

BIND9 vs Alternatives

DNS Server ราคา จุดเด่น เหมาะกับ
BIND9 ฟรี (open-source) Feature ครบ มาตรฐาน industry Enterprise Linux environments
Windows DNS มากับ Windows Server AD integration ดีมาก Windows AD environments
Unbound ฟรี (open-source) Recursive resolver เร็ว Caching/forwarding DNS
Pi-hole ฟรี (open-source) DNS filtering/ad blocking Home/small office ad blocking
Infoblox แพงมาก Enterprise DDI (DNS/DHCP/IPAM) Large enterprise

ทิ้งท้าย: DNS เป็นพื้นฐานที่สำคัญที่สุด

DNS เป็น service ที่สำคัญที่สุดใน network ถ้า DNS ล่ม แทบทุกอย่างจะใช้งานไม่ได้ ติดตั้ง BIND9 สำหรับ internal DNS ตั้ง secondary DNS สำหรับ redundancy restrict recursion สำหรับ security ทดสอบให้มั่นใจก่อน deploy production

อ่านเพิ่มเติมเกี่ยวกับ DHCP Server และ Network Design ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com

จัดส่งรวดเร็วส่งด่วนทั่วประเทศ
รับประกันสินค้าเคลมง่าย มีใบรับประกัน
ผ่อนชำระได้บัตรเครดิต 0% สูงสุด 10 เดือน
สะสมแต้ม รับส่วนลดส่วนลดและคะแนนสะสม

© 2026 SiamLancard — จำหน่ายการ์ดแลน อุปกรณ์ Server และเครื่องพิมพ์ใบเสร็จ

SiamLancard
Logo
Free Forex EA Download — XM Signal · EA Forex ฟรี
iCafeForex.com - สอนเทรด Forex | SiamCafe.net
Shopping cart