แก้ DNS Error ใน Domain บน Windows Server 2022 แบบละเอียด

 DNS เป็นหัวใจสำคัญของ Active Directory บน Windows Server 2022 เพราะทุกบริการสำคัญใน Domain ไม่ว่าจะเป็น User Login, Group Policy, Replication หรือ Authentication ล้วนต้องพึ่งพา DNS

ในความเป็นจริง ปัญหา Active Directory มากกว่า 70% มักมีต้นเหตุมาจาก DNS ที่ตั้งค่าไม่ถูกต้อง

บทความนี้จะอธิบายวิธีวิเคราะห์และแก้ DNS Error ใน Domain บน Windows Server 2022 แบบละเอียด พร้อมแนวทางที่ผู้ดูแลระบบใช้งานจริง

📌 ทำไม DNS ถึงสำคัญกับ Active Directory

Active Directory ใช้ DNS สำหรับ

  • ค้นหา Domain Controller

  • ค้นหา Global Catalog

  • Kerberos Authentication

  • Replication

  • Group Policy

  • LDAP Services

หาก DNS มีปัญหา

อาจเกิดผลกระทบต่อทั้งระบบ Domain

🎯 อาการที่บ่งบอกว่า DNS มีปัญหา

อาการที่พบได้บ่อย

❌ User Login ช้า

❌ Join Domain ไม่ได้

❌ Group Policy ไม่ทำงาน

❌ Replication Error

❌ Domain Controller หาไม่เจอ

❌ DNS Lookup Failure

❌ Kerberos Error

หลายเคสที่ทีมงาน comsiam เข้าไปแก้ไข Active Directory พบว่าปัญหาเริ่มต้นจากการกำหนด DNS Server ผิดเพียงจุดเดียว

🔍 ตรวจสอบ DNS เบื้องต้น

รัน

ipconfig /all

ตรวจสอบ

DNS Servers

ตัวอย่างที่ถูกต้อง

192.168.1.10
192.168.1.11

ซึ่งเป็น Domain Controller

⚠️ การตั้งค่า DNS ที่ผิด

ไม่ควรตั้งค่า

8.8.8.8
1.1.1.1

เป็น DNS หลักบน Domain Controller

เพราะ Active Directory จะทำงานผิดพลาด

🚀 ตรวจสอบ DNS Health

รัน

dcdiag /test:dns

หากทุกอย่างปกติ

จะพบ

PASS

ทุกหัวข้อ

🔍 ตรวจสอบ Domain Name Resolution

รัน

nslookup company.local

ผลลัพธ์ควรชี้ไปยัง Domain Controller

🌐 ตรวจสอบ Domain Controller

รัน

nslookup dc01.company.local

และ

nslookup dc02.company.local

หากหาไม่เจอ

DNS มีปัญหาแน่นอน

📂 ตรวจสอบ SRV Records

SRV Record คือหัวใจของ Active Directory

รัน

nslookup
set type=SRV
_ldap._tcp.dc._msdcs.company.local

ควรเห็นรายการ Domain Controller

ทั้งหมด

⚙️ ตรวจสอบ DNS Zone

เปิด

DNS Manager

ตรวจสอบ

Forward Lookup Zones

ควรมี

company.local

อยู่ในระบบ

🔍 ตรวจสอบ Active Directory Integrated Zone

คลิกขวา Zone

เลือก

Properties

ควรเป็น

Active Directory-Integrated

เพื่อรองรับ Replication

🔄 บังคับ Register DNS ใหม่

รัน

ipconfig /registerdns

จากนั้น

ipconfig /flushdns

🔄 Restart Netlogon Service

รัน

net stop netlogon
net start netlogon

Windows จะสร้าง SRV Records ใหม่

อัตโนมัติ

⚠️ Error : DNS Lookup Failure

ตัวอย่าง

DNS lookup failure

สาเหตุ

  • DNS Server ผิด

  • Zone หาย

  • SRV Record หาย

วิธีแก้

① ตรวจสอบ DNS Zone

② Restart Netlogon

③ Register DNS ใหม่

④ ตรวจสอบ Replication

⚠️ Error : Event ID 4013

ตัวอย่าง

Event ID 4013

สาเหตุ

DNS รอ Active Directory โหลดข้อมูล

วิธีแก้

ตรวจสอบ

dcdiag

และ

repadmin /replsummary

⚠️ Error : Event ID 4015

มักเกี่ยวข้องกับ

  • AD Database

  • DNS Service

  • Replication

ควรตรวจสอบ Event Viewer เพิ่มเติม

🖥️ ตรวจสอบ DNS ผ่าน PowerShell

รัน

Get-DnsServerZone

ดู Zone ทั้งหมด

🔍 ตรวจสอบ Resource Records

รัน

Get-DnsServerResourceRecord
-ZoneName "company.local"

🔄 ตรวจสอบ Replication ของ DNS

รัน

repadmin /showrepl

หาก DNS Zone ไม่ Replicate

ข้อมูล DNS จะไม่ตรงกัน

📖 ตรวจสอบ Event Viewer

เปิด

Event Viewer

ไปที่

Applications and Services Logs
 └ DNS Server

ตรวจสอบ Error และ Warning

📋 Checklist แก้ DNS Error

① DNS Server ชี้หา Domain Controller

② DNS Zone อยู่ครบ

③ SRV Records อยู่ครบ

④ Domain Controller Resolve ชื่อได้

⑤ Replication ปกติ

⑥ Event Viewer ไม่มี Error

⑦ DCDIAG ผ่าน

📈 Best Practices สำหรับ DNS ใน Active Directory

① ใช้ DNS ภายในเท่านั้น

② ใช้ Active Directory Integrated Zone

③ มี DNS อย่างน้อย 2 เครื่อง

④ ตรวจสอบ DNS Health ทุกสัปดาห์

⑤ ตรวจสอบ Event Viewer เป็นประจำ

⑥ ตรวจสอบ SRV Records หลังเพิ่ม Domain Controller

หลายองค์กรที่ comsiam ดูแล มีการกำหนด DNS Health Check รายสัปดาห์ เพราะ DNS คือองค์ประกอบที่ส่งผลต่อ Active Directory มากที่สุด

🎯 สรุป

DNS คือหัวใจของ Active Directory บน Windows Server 2022 หาก DNS มีปัญหา อาจส่งผลต่อ User Login, Group Policy, Replication และบริการทั้งหมดภายใน Domain

การตรวจสอบด้วย DCDIAG, NSLOOKUP, DNS Manager, PowerShell และ Event Viewer อย่างสม่ำเสมอ จะช่วยให้ผู้ดูแลระบบสามารถค้นหาสาเหตุและแก้ไข DNS Error ได้อย่างรวดเร็ว ก่อนที่จะส่งผลกระทบต่อผู้ใช้งานทั้งองค์กร

Popular posts from this blog

Windows Server 2022 ยังน่าใช้ในปีนี้หรือไม่? คำตอบสำหรับคนกำลังวางระบบใหม่

สเปกเครื่องสำหรับติดตั้ง Windows Server 2022 เลือกอย่างไรให้คุ้มและใช้งานได้ยาว

Windows Server 2022 คืออะไร? คู่มือสำหรับมือใหม่