Adjusting Network Time Protocol: Linux and Windows

Posted: March 26th, 2015

 

Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems. It is used to maintain the system time. The server used by this service can be changed on all operating systems.

 

Plesk users can use these instructions: Adjusting system time in Plesk

 

Linux (Scroll down for Windows)

 

Debian/Ubuntu first step:

 

 

1. Verify if NTP is installed:

 

# dpkg --list ntp

 

 

1.1 If nothing is returned by the previous command, you must install the service with 'apt-get' as it is not installed:

 

# apt-get install ntp

 

CentOS first step:

 

1. Verify if NTP is installed:

 

# rpm -qa ntp

 

 

1.1 If nothing is returned by the previous command, you must install the service with 'yum' as it is not installed:

 

# yum install ntp

# chkconfig ntpd on

 

 

2. Ensure that the service is stopped before performing modifications to it:

 

# /etc/init.d/ntpd stop

 

 

3. Launch a manual update to force synchronization in case your time difference with the server is too big:

 

# ntpdate ntp.privatedns.com

 

 

4. Modify the NTP configuration file with your favourite text editor (vi, vim, nano, etc):

 

# vi /etc/ntp.conf

 

 

All the entries in the file that start with 'server' are the NTP servers used by the NTP service. To use iWeb's NTP server, they should all be removed and one of the following 'server' entries should be present in the configuration file:

 

> server ntp01.ne.iweb.com

 

> server ntp01.co.iweb.com

> server ntp01.cl.iweb.com

> server ca.pool.ntp.org

 

5. Apply the changes by restarting the service:

 

# /etc/init.d/ntpd restart

 

 

6. Verify the change has been properly applied and the newly configured server is used:

 

# ntpq -p -n

 

 

7. To verify the system time, you can use the following command:

 

# date

 

 

Microsoft Windows

 

1. Open a command prompt (or PowerShell console) as an administrator user to ensure you can run all the system commands.

 

2. Stop the W32Time service:

 

C:\> net stop w32time

 

 

3. Configure the external time source(s) with one of the servers below:

 

C:\> w32tm /config /syncfromflags:manual /manualpeerlist:"ntp01.ne.iweb.com, ntp01.co.iweb.com, ntp01.cl.iweb.com, ca.pool.ntp.org"

 

 

3.1 If you use AD, make your PDC a reliable time source for the clients:

 

C:\> w32tm /config /reliable:yes

 

 

4. Start the w32time service:

 

C:\> net start w32time

 

 

5. The windows time service should begin synchronizing the time. You can check the external NTP servers in the time configuration by typing:

 

 

C:\> w32tm /query /configuration