To sync Windows with Debian’s time, we are going to use the NTP.
First of all, we’re going to set up NTP on the Debian PC first.
Install the NTP package.
apt-get install ntp
After that, open the configuration file with a text editor.
Edit the configuration file so that it looks something like below. What it does is that it sets the NTP to listen to the interface with 10.10.0.1 and set the local pc to sync from the debian.pool.org time server.
listen to 10.10.0.1 server 0.debian.pool.ntp.org iburst dynamic server 1.debian.pool.ntp.org iburst dynamic server 2.debian.pool.ntp.org iburst dynamic server 3.debian.pool.ntp.org iburst dynamic
Save and restart NTP service.
service ntp restart
Now, after we’re done with Debian, we can start working on the Windows Server.
For Windows Server 2008 R2, we will first have to manually configure the time to be close to the time on the Debian server. This is to ensure that after we’re done setting up, we won’t have to wait for a long time for the time to sync.
Open the registry editor by going to run->regedit.
Do a backup of the registry if needed.
Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\.
Below are the registries that requires editing.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\Type Set to NTP HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\AnnouceFlags Set to 5 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer\Enabled Set to 1 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\NtpServer Set to (Ip address),0x9 for my case, 10.10.0.1,0x9 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient\SpecialPollInterval\ For my case, i'm setting the poll interval to be 900 seconds. set to 900
That is all for the registry editing.
Open command prompt and enter the following command to restart the w32time service.
net stop w32time && net start w32time
For Windows XP/Vista/7, it is much more simpler. All we have to do is to open date and time from control panel, go to the Internet Time tab and click on Change settings…, replace time.windows.com with the IP address of your NTP server and you’re good to go.
To test if the synchronisation have taken place, open command prompt and enter the following command.
w32tm /query /verbose /peers
You should see this in your console.