Domain-Name-System

即使禁用了 AD 日誌查詢的 DNS 伺服器

  • January 25, 2022

我有兩個執行 DNS 的 Server 2012 R2 DC。

DNS 伺服器在 GUI 中關閉了調試日誌,但是我每天收到 500MBdns#TIMESTAMP#.log的文件C:\Windows\System32\DNS\Logs\

我執行了 PowerShell**get-dnsserverdiagnostics**

SaveLogsToPersistentStorage          : True
Queries                              : False
Answers                              : False
Notifications                        : False
Update                               : False
QuestionTransactions                 : False
UnmatchedResponse                    : False
SendPackets                          : False
ReceivePackets                       : False
TcpPackets                           : False
UdpPackets                           : False
FullPackets                          : False
FilterIPAddressList                  :
EventLogLevel                        : 2
UseSystemEventLog                    : False
EnableLoggingToFile                  : True
EnableLogFileRollover                : True
LogFilePath                          : c:\windows\system32\dns\logs\dns.log
MaxMBFileSize                        : 500000000
WriteThrough                         : False
EnableLoggingForLocalLookupEvent     : True
EnableLoggingForPluginDllEvent       : True
EnableLoggingForRecursiveLookupEvent : True
EnableLoggingForRemoteServerEvent    : True
EnableLoggingForServerStartStopEvent : True
EnableLoggingForTombstoneEvent       : True
EnableLoggingForZoneDataWriteEvent   : True
EnableLoggingForZoneLoadingEvent     : True

頂部的查詢 - FullPackets 似乎是 DNS 調試日誌部分。在 GUI 中哪裡可以禁用 EnableLoggingtoFile 和 SaveLogs?當然,隨著時間的推移,每天 500MB 的文件會堵塞硬碟。

發現 GUI DNS 調試日誌屬性控制頂部部分,查詢 - FullPackets,但如果底部部分設置為 True,即使SaveLogsToPersistentStorage 設置為 False,它們也會被記錄。

這通過比較啟用和未啟用底部部分的日誌數據得到證實。啟用了標準 GUI DNS 調試日誌屬性數據的 DNS 日誌如下所示:

8/17/2018 9:08:39 AM 1B70 PACKET  00000041E490A160 UDP Snd 8.8.4.4         524b   Q [0001   D   NOERROR] A      (8)clients6(6)google(3)com(0)
8/17/2018 9:08:39 AM 1B70 PACKET  00000041E38B8170 UDP Snd 10.200.56.5     a3ae R Q [8081   DR  NOERROR] A      (8)clients6(6)google(3)com(0)  

但更詳細的日誌如下所示:

8/15/2018 9:52:55 PM 1338 LOOKUP  Writing AAAA records for node #DC#.local. (000000D5CAC007C0)
                    to additional section of packet 000000D5CC19A130
8/15/2018 9:52:55 PM 1338 LOOKUP  Writing A records for node #DC#.local. (000000D5CAC004A0)
                    to additional section of packet 000000D5CC19A130
8/15/2018 9:52:55 PM 1338 LOOKUP  Writing AAAA records for node #DC#.local. (000000D5CAC004A0)
                    to additional section of packet 000000D5CC19A130
8/15/2018 9:52:55 PM 1338 LOOKUP  Writing A records for node #DC#.local. (000000D5CABFD330)
                    to additional section of packet 000000D5CC19A130
8/15/2018 9:52:55 PM 1338 LOOKUP  Writing AAAA records for node #DC#.local. (000000D5CABFD330)
                    to additional section of packet 000000D5CC19A130
8/15/2018 9:52:55 PM 1338 LOOKUP  Query name (1)1(1)0(1)0(3)127(7)in-addr(4)arpa(0)
                    zone          127.in-addr.arpa (type 1)
                    node          1.0.0.127.in-addr.arpa. (000000D5CABF6B40)
                    closest node  1.0.0.127.in-addr.arpa. (000000D5CABF6B40)

因此,我通過以下方式關閉了 Powershell 的高級日誌記錄選項:

set-dnsserverdiagnostics 
-EnableLoggingForLocalLookupEvent False 
-EnableLoggingForPluginDllEvent False 
-EnableLoggingForRecursiveLookupEvent False 
-EnableLoggingForRemoteServerEvent False 
-EnableLoggingForServerStartStopEvent False 
-EnableLoggingForTombstoneEvent False 
-EnableLoggingForZoneDataWriteEvent False 
-EnableLoggingForZoneLoadingEvent False

引用自:https://serverfault.com/questions/926513