본문 바로가기

Windows/기술과 팁

[명령어] Windows 시간 동기화


기본적으로 Windows 서버는 time.windows.com 을 이용해 시간 동기화를 하게 되어 있다.
AD 도메인 환경의 경우, PDC 서버가 외부 Time Server (ex. time.windows.com)로부터 정확한 시간을 받아와서 도메인 내부 다른 서버 또는 클라이언트 PC에게 정확한 시각을 동기화 시켜주게 된다.

가끔씩 외부 Time Server와의 연결이 끊기거나, 외부 Time Server 가 비정상적인 시간을 알려주는 경우가 있다.
이런 경우 아래와 같은 에러, 경고, 정보 등의 항목으로 시스템 이벤트 로그가 발생하게 된다.



각 이벤트 상세 내용은 아래와 같다.

Event Type: Information
Event Source: W32Time
Event Category: None
Event ID: 38
Date:  8/31/2011
Time:  9:39:31 AM
User:  N/A
Computer: AD-PDC
Description:
The time provider NtpClient cannot reach or is currently receiving invalid time data from time.windows.com (ntp.m|0x1|1xx.1xx.3x.2xx:123->65.55.56.40:123).

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


Event Type: Warning
Event Source: W32Time
Event Category: None
Event ID: 47
Date:  8/31/2011
Time:  2:39:31 PM
User:  N/A
Computer: AD-PDC
Description:
Time Provider NtpClient: No valid response has been received from  manually configured peer time.windows.com,0x1 after 8 attempts to contact it. This peer will be discarded as a time source and NtpClient will attempt to discover a new peer  with this DNS name. 

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


Event Type: Error
Event Source: W32Time
Event Category: None
Event ID: 29
Date:  8/31/2011
Time:  2:39:31 PM
User:  N/A
Computer: AD-PDC
Description:
The time provider NtpClient is configured to acquire time from one or more time sources, however none of the sources are currently accessible.  No attempt to contact a source will be made for 120 minutes. NtpClient has no source of accurate time.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


AD의 PDC 서버라면 아래와 같이 Time Server를 바꿔 주는 방법으로 문제를 해결 할 수 있다.

1. Regedit 를 통해 현재 타임 서버를 확인하고 해당 타임서버와 시간동기화가 되는지 명령어로 확인한다.
아래 그림을 보면, NtpServer(타임서버)는 time.windows.com,0x1 로 되어 있고 Type은 NTP로 되어 있음을 알 수 있다. (도메인 멤버컴퓨터의 경우 Type이 다르다.)
동기화 명령어는 아래와 같다.
C:\> w32tm /resync




2. 위에서 보는 바와 같이 기존 타임 서버와 시간 동기화가 안되고 있다. 물론 여기에는 네트워크 문제, 123 port 방화벽 제한, Time Zone 불일치 등과 같은 많은 원인이 있을 수 있다. 하지만, 이번에는 특정 Time Server에 문제가 있다는 가정하에 Time Server를 아래와 같이 바꿔주고, Window Time Service를 재시작 후 시간 동기화를 다시 해 본다.

C:\> w32tm /config /manualpeerlist:"time.nist.gov,0x9" /syncfromflags:MANUAL
C:\> net stop w32time
C:\> net start w32time
C:\> w32tm /resync



3. 그 결과 위 그림과 같이 동기화 성공이라는 메시지가 나온다.
이벤트 로그를 확인해 보면 아래 내용으로 성공 이벤트를 확인할 수 있다.

Event Type: Information
Event Source: W32Time
Event Category: None
Event ID: 37
Date:  8/31/2011
Time:  6:14:26 PM
User:  N/A
Computer: AD-PDC
Description:
The time provider NtpClient is currently receiving valid time data from time.nist.gov (ntp.m|0x9|1xx.1x.xx.xxx:123->192.43.244.18:123).

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


Event Type: Information
Event Source: W32Time
Event Category: None
Event ID: 35
Date:  8/31/2011
Time:  6:14:46 PM
User:  N/A
Computer: AD-PDC
Description:
The time service is now synchronizing the system time with the time source time.nist.gov (ntp.m|0x9|1xx.1xx.1xx.2xx:123->192.43.244.18:123).

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


참고로 시간 동기화는 123번 포트를 사용한다.

Time Zone을 확인할 때도 w32tm 명령어로 확인 가능하다.
C:\>w32tm /tz
시간대: Current:TIME_ZONE_ID_UNKNOWN Bias: -540min (UTC=LocalTime+Bias)
  [Standard Name:"대한민국 표준시" Bias:0min Date:(지정되지 않음)]
  [Daylight Name:"대한민국 일광 절약 시간" Bias:-60min Date:(지정되지 않음)]

또한, 시간과 관련된 모든 설정값을 보려면 아래 명령어로 가능하다.
C:\>w32tm /query /configuration
[구성]

EventLogFlags: 2 (로컬)
AnnounceFlags: 10 (로컬)
TimeJumpAuditOffset: 28800 (로컬)
MinPollInterval: 10 (로컬)
MaxPollInterval: 15 (로컬)
MaxNegPhaseCorrection: 54000 (로컬)
MaxPosPhaseCorrection: 54000 (로컬)
MaxAllowedPhaseOffset: 1 (로컬)

FrequencyCorrectRate: 4 (로컬)
PollAdjustFactor: 5 (로컬)
LargePhaseOffset: 50000000 (로컬)
SpikeWatchPeriod: 900 (로컬)
LocalClockDispersion: 10 (로컬)
HoldPeriod: 5 (로컬)
PhaseCorrectRate: 1 (로컬)
UpdateInterval: 360000 (로컬)

[시간 공급자]

NtpClient (로컬)
DllName: C:\Windows\system32\w32time.dll (로컬)
Enabled: 1 (로컬)
InputProvider: 1 (로컬)
AllowNonstandardModeCombinations: 1 (로컬)
ResolvePeerBackoffMinutes: 15 (로컬)
ResolvePeerBackoffMaxTimes: 7 (로컬)
CompatibilityFlags: 2147483648 (로컬)
EventLogFlags: 1 (로컬)
LargeSampleSkew: 3 (로컬)
SpecialPollInterval: 604800 (로컬)
Type: NTP (로컬)
NtpServer: time.nist.gov,0x9 (로컬)

VMICTimeProvider (로컬)
DllName: C:\Windows\System32\vmictimeprovider.dll (로컬)
Enabled: 1 (로컬)
InputProvider: 1 (로컬)
NtpServer (로컬)
DllName: C:\Windows\system32\w32time.dll (로컬)
Enabled: 0 (로컬)
InputProvider: 0 (로컬)

* 인터넷에서 사용할 있는 SNTP(단일 네트워크 기간 프로토콜) 시간 서버 목록

http://support.microsoft.com/kb/262680/ko