How to sync time in Linux from NTP server (Windows) ?

Time sync in Linux from NTP server, in our guide we are using below specifications.

NTP server

OS        : windows 2008 R2, windows Active Directory server is acting as NTP server.
IP address : 192.168.0.2
Role       : NTP server

NTP client

OS       : Centos release 6.5 (final)
IP       : 192.168.1.44
Hardware : 32bit
Role     : NTP client

Steps  :

Step 1 : Create NTP update script in cron job

Step 2 : Stop and Start crond deamon

Step 3 : Verify configuration

Let us see the steps in Details :

Step 1 : Create NTP update script in cron job

The Location for cron jobs

/etc/cron.daily/ : script to automate the tasks on daily

/etc/cron.hourly/ : script to automate the tasks on hourly

/etc/cron.weekly/ : script to automate the tasks on weekly

/etc/cron.monthly/ : script to automate the tasks on monthly

1.1

Create a file ntpupdate in /etc/crond.daily/ntpupdate

[root@experts ~]# vi /etc/cron.hourly/ntpupdate

ntpdate 192.168.0.2

hwclock –w

save & exit(:wq!)

1.2

Set the permissions on ntpupdate file created in step 1.1

[root@experts ~]#chmod a+x /etc/cron.hourly/ntpupdate

Step 2 : Stop and Start crond deamon

[root@experts ~]#chkconfig crond on

[root@experts ~]#service crond restart 

Step 3 : Verify configuration

Check the cron job execution logs

[root@experts ~]#tail –f  /var/log/cron

Verify Time sync status

[root@experts ~]#date

Thank You.

For more detail you can watch the Video : 

Both comments and pings are currently closed.

Comments are closed.

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk